85 lines
1.9 KiB
Plaintext
85 lines
1.9 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum RequestStatus {
|
|
pending
|
|
completed
|
|
needs_attention
|
|
}
|
|
|
|
enum JobState {
|
|
requested
|
|
matching
|
|
matched
|
|
downloading
|
|
tagging
|
|
imported
|
|
needs_attention
|
|
}
|
|
|
|
model Request {
|
|
id String @id @default(cuid())
|
|
artist String
|
|
album String
|
|
status RequestStatus @default(pending)
|
|
createdAt DateTime @default(now())
|
|
job Job?
|
|
libraryItem LibraryItem?
|
|
}
|
|
|
|
model Job {
|
|
id String @id @default(cuid())
|
|
request Request @relation(fields: [requestId], references: [id], onDelete: Cascade)
|
|
requestId String @unique
|
|
state JobState @default(requested)
|
|
currentStage String @default("intake")
|
|
attempts Int @default(0)
|
|
error String?
|
|
claimedAt DateTime?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
candidates Candidate[]
|
|
}
|
|
|
|
model Candidate {
|
|
id String @id @default(cuid())
|
|
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)
|
|
jobId String
|
|
source String
|
|
format String
|
|
qualityClass Int
|
|
trackCount Int
|
|
confidence Float
|
|
sourceRef String
|
|
chosen Boolean @default(false)
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model LibraryItem {
|
|
id String @id @default(cuid())
|
|
request Request @relation(fields: [requestId], references: [id], onDelete: Cascade)
|
|
requestId String @unique
|
|
artist String
|
|
album String
|
|
path String
|
|
source String
|
|
format String
|
|
qualityClass Int
|
|
importedAt DateTime @default(now())
|
|
|
|
@@unique([artist, album])
|
|
}
|
|
|
|
model Config {
|
|
key String @id
|
|
value String
|
|
secret Boolean @default(false)
|
|
updatedAt DateTime @updatedAt
|
|
}
|