feat: add SkippedPackage model for tracking skipped/failed archives

Adds SkipReason enum (SIZE_LIMIT, DOWNLOAD_FAILED, EXTRACT_FAILED,
UPLOAD_FAILED) and SkippedPackage model with unique constraint on
(sourceChannelId, sourceMessageId). Reverse relations added to
TelegramAccount and TelegramChannel.

Note: Run `npx prisma migrate dev --name add-skipped-packages` when
database is available to create the migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 16:11:56 +01:00
parent 9642adaba7
commit 780e6200d8

View File

@@ -412,6 +412,7 @@ model TelegramAccount {
channelMaps AccountChannelMap[] channelMaps AccountChannelMap[]
ingestionRuns IngestionRun[] ingestionRuns IngestionRun[]
fetchRequests ChannelFetchRequest[] fetchRequests ChannelFetchRequest[]
skippedPackages SkippedPackage[]
@@index([isActive]) @@index([isActive])
@@map("telegram_accounts") @@map("telegram_accounts")
@@ -430,6 +431,7 @@ model TelegramChannel {
accountMaps AccountChannelMap[] accountMaps AccountChannelMap[]
packages Package[] packages Package[]
skippedPackages SkippedPackage[]
@@index([type, isActive]) @@index([type, isActive])
@@index([category]) @@index([category])
@@ -686,6 +688,39 @@ model ArchiveExtractRequest {
@@map("archive_extract_requests") @@map("archive_extract_requests")
} }
// ───────────────────────────────────────
// Skipped/Failed Archives
// ───────────────────────────────────────
enum SkipReason {
SIZE_LIMIT
DOWNLOAD_FAILED
EXTRACT_FAILED
UPLOAD_FAILED
}
model SkippedPackage {
id String @id @default(cuid())
fileName String
fileSize BigInt
reason SkipReason
errorMessage String?
sourceChannelId String
sourceChannel TelegramChannel @relation(fields: [sourceChannelId], references: [id], onDelete: Cascade)
sourceMessageId BigInt
sourceTopicId BigInt?
isMultipart Boolean @default(false)
partCount Int @default(1)
accountId String
account TelegramAccount @relation(fields: [accountId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
@@unique([sourceChannelId, sourceMessageId])
@@index([reason])
@@index([accountId])
@@map("skipped_packages")
}
// ─────────────────────────────────────── // ───────────────────────────────────────
// Purchased Kickstarters // Purchased Kickstarters
// ─────────────────────────────────────── // ───────────────────────────────────────