feature: version one notification feature implemented.

This commit is contained in:
2026-07-18 01:09:54 +03:30
parent 0740493384
commit 9f6ec193d2
40 changed files with 1679 additions and 224 deletions

View File

@@ -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