Added congregation table and field

This commit is contained in:
Dobromir Popov
2024-05-11 12:45:52 +03:00
parent 7f5b97a66f
commit 2baab97902
7 changed files with 199 additions and 46 deletions

View File

@ -124,6 +124,18 @@ model Publisher {
EventLog EventLog[]
lastLogin DateTime?
pushSubscription Json?
originalAssignments Assignment[] @relation("OriginalPublisher")
congregation Congregation? @relation(fields: [congregationId], references: [id])
congregationId Int?
locale String? @default("bg")
}
model Congregation {
id Int @id @default(autoincrement())
name String
address String
isActive Boolean @default(true)
publishers Publisher[]
}
model Availability {
@ -181,23 +193,25 @@ model Shift {
//date DateTime
reportId Int? @unique
Report Report? @relation(fields: [reportId], references: [id])
isPublished Boolean @default(false) //NEW v1.0.1
isPublished Boolean @default(false)
EventLog EventLog[]
@@map("Shift")
}
model Assignment {
id Int @id @default(autoincrement())
shift Shift @relation(fields: [shiftId], references: [id], onDelete: Cascade)
shiftId Int
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
publisherId String
isBySystem Boolean @default(false) // if no availability for it, when importing previous schedules
isConfirmed Boolean @default(false)
isWithTransport Boolean @default(false)
isMailSent Boolean @default(false)
publicGuid String? @unique
id Int @id @default(autoincrement())
shift Shift @relation(fields: [shiftId], references: [id], onDelete: Cascade)
shiftId Int
publisher Publisher @relation(fields: [publisherId], references: [id], onDelete: Cascade)
publisherId String
isBySystem Boolean @default(false) // if no availability for it, when importing previous schedules
isConfirmed Boolean @default(false)
isWithTransport Boolean @default(false)
isMailSent Boolean @default(false)
publicGuid String? @unique
originalPublisherId String? // New field to store the original publisher id when the assignment is replaced
originalPublisher Publisher? @relation("OriginalPublisher", fields: [originalPublisherId], references: [id])
@@map("Assignment")
}
@ -237,6 +251,7 @@ model Report {
experienceInfo String? @db.LongText
type ReportType @default(ServiceReport)
comments String?
@@map("Report")
}
@ -258,6 +273,7 @@ model Message {
isRead Boolean @default(false)
isPublic Boolean @default(false)
type MessageType @default(Email)
publicUntil DateTime?
}
enum EventLogType {