feature: version one notification feature implemented.
This commit is contained in:
@@ -30,6 +30,8 @@ model User {
|
||||
labCaseComments LabCaseComment[]
|
||||
labCaseActivities LabCaseActivity[]
|
||||
phoneVerificationCodes PhoneVerificationCode[]
|
||||
userNotifications UserNotification[]
|
||||
actedUserNotifications UserNotification[] @relation("UserNotificationActor")
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -435,6 +437,38 @@ enum LabCaseTabReadTarget {
|
||||
TREATMENT
|
||||
}
|
||||
|
||||
enum UserNotificationType {
|
||||
CASE_SENT
|
||||
CLINIC_COMMENT
|
||||
LAB_COMMENT
|
||||
LAB_COMMENT_CLINIC
|
||||
CASE_IMPORTANT
|
||||
TASK_COMPLETED
|
||||
TASK_ASSIGNED
|
||||
CONNECTION_REQUEST
|
||||
STAFF_INVITE
|
||||
}
|
||||
|
||||
/// Fan-out inbox row per recipient. Independent of LabCaseActivity tab badges.
|
||||
model UserNotification {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
organizationId String
|
||||
type UserNotificationType
|
||||
actorUserId String?
|
||||
payload Json?
|
||||
href String
|
||||
readAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
actorUser User? @relation("UserNotificationActor", fields: [actorUserId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([userId, organizationId, createdAt])
|
||||
@@index([userId, organizationId, readAt])
|
||||
@@map("user_notifications")
|
||||
}
|
||||
|
||||
model LabCaseActivity {
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
|
||||
Reference in New Issue
Block a user