feat: add PackageGroup schema for album-based file grouping

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 22:21:52 +01:00
parent 6eb7129637
commit e4398caebe
2 changed files with 51 additions and 0 deletions

View File

@@ -432,6 +432,7 @@ model TelegramChannel {
accountMaps AccountChannelMap[]
packages Package[]
skippedPackages SkippedPackage[]
packageGroups PackageGroup[]
@@index([type, isActive])
@@index([category])
@@ -474,10 +475,12 @@ model Package {
tags String[] @default([])
previewData Bytes? // JPEG thumbnail from nearby Telegram photo (stored as raw bytes)
previewMsgId BigInt? // Telegram message ID of the matched photo
packageGroupId String?
indexedAt DateTime @default(now())
createdAt DateTime @default(now())
sourceChannel TelegramChannel @relation(fields: [sourceChannelId], references: [id])
packageGroup PackageGroup? @relation(fields: [packageGroupId], references: [id], onDelete: SetNull)
files PackageFile[]
ingestionRun IngestionRun? @relation(fields: [ingestionRunId], references: [id])
ingestionRunId String?
@@ -491,6 +494,7 @@ model Package {
@@index([indexedAt])
@@index([archiveType])
@@index([creator])
@@index([packageGroupId])
@@map("packages")
}
@@ -512,6 +516,23 @@ model PackageFile {
@@map("package_files")
}
model PackageGroup {
id String @id @default(cuid())
name String
mediaAlbumId String?
sourceChannelId String
previewData Bytes?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
packages Package[]
sourceChannel TelegramChannel @relation(fields: [sourceChannelId], references: [id], onDelete: Cascade)
@@unique([mediaAlbumId, sourceChannelId])
@@index([sourceChannelId])
@@map("package_groups")
}
model IngestionRun {
id String @id @default(cuid())
accountId String