feat: add channel categories and improved creator detection

- Add category field to TelegramChannel (filterable tag like STL, PDF, D&D)
- Category column in channels table with edit via dropdown menu
- Improved creator extraction: filename patterns + channel title fallback
- extractCreatorFromChannelTitle strips [Completed], (Paid), emoji, etc.
- Fix ArchiveType in PackageListItem and PackageRow for new types
- Add Prisma migration for category column
This commit is contained in:
admin
2026-03-21 20:37:44 +01:00
parent 53a76a8136
commit 36a7e3d5f4
10 changed files with 126 additions and 14 deletions

View File

@@ -259,6 +259,25 @@ export async function deleteChannel(id: string): Promise<ActionResult> {
}
}
export async function setChannelCategory(
id: string,
category: string | null
): Promise<ActionResult> {
const admin = await requireAdmin();
if (!admin.success) return admin;
try {
await prisma.telegramChannel.update({
where: { id },
data: { category: category?.trim() || null },
});
revalidatePath("/telegram");
return { success: true, data: undefined };
} catch {
return { success: false, error: "Failed to update category" };
}
}
export async function setChannelType(
id: string,
type: "SOURCE" | "DESTINATION"