feat: prisma schema and voucher status
This commit is contained in:
1 parent
5ba920eb11
commit
159b549bf7
4 files changed
+82
No files matched your search
@@ -0,0 +1,57 @@
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
model Voucher {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
anbieter String
|
||||
wertCents Int
|
||||
restCents Int
|
||||
ablaufdatum DateTime?
|
||||
codeText String?
|
||||
kategorie String?
|
||||
notiz String?
|
||||
status String @default("aktiv")
|
||||
contacts VoucherContact[]
|
||||
rules ReminderRule[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
model Contact {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
email String?
|
||||
telegramChatId String?
|
||||
vouchers VoucherContact[]
|
||||
}
|
||||
model VoucherContact {
|
||||
voucherId Int
|
||||
contactId Int
|
||||
voucher Voucher @relation(fields: [voucherId], references: [id], onDelete: Cascade)
|
||||
contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade)
|
||||
@@id([voucherId, contactId])
|
||||
}
|
||||
model ReminderRule {
|
||||
id Int @id @default(autoincrement())
|
||||
voucherId Int
|
||||
tageVorher Int
|
||||
voucher Voucher @relation(fields: [voucherId], references: [id], onDelete: Cascade)
|
||||
logs NotificationLog[]
|
||||
@@unique([voucherId, tageVorher])
|
||||
}
|
||||
model NotificationLog {
|
||||
id Int @id @default(autoincrement())
|
||||
ruleId Int
|
||||
kanal String
|
||||
empfaenger String
|
||||
zielDatum String
|
||||
status String
|
||||
fehler String?
|
||||
sentAt DateTime @default(now())
|
||||
rule ReminderRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
||||
@@unique([ruleId, kanal, empfaenger, zielDatum])
|
||||
}
|
||||
Reference in new issue
Block a user