improvement: notify counter badge added to treatment and tasks tabs for upadted and edited cases.

This commit is contained in:
2026-07-13 17:44:44 +03:30
parent 547457d637
commit 2ad572f4c8
33 changed files with 908 additions and 31 deletions

View File

@@ -28,6 +28,7 @@ model User {
assignedLabCaseTasks LabCaseTask[] @relation("LabCaseTaskAssignee")
labCaseTaskStatusEvents LabCaseTaskStatusEvent[]
labCaseComments LabCaseComment[]
labCaseActivities LabCaseActivity[]
phoneVerificationCodes PhoneVerificationCode[]
createdAt DateTime @default(now())
@@ -224,6 +225,8 @@ model LabCase {
toothProsthesis LabCaseToothProsthesis[]
comments LabCaseComment[]
attachments LabCaseAttachment[]
activities LabCaseActivity[]
userReadStates LabCaseUserReadState[]
@@index([treatmentId, sortOrder])
@@map("lab_cases")
@@ -410,6 +413,60 @@ model LabCaseComment {
@@map("lab_case_comments")
}
enum LabCaseActivityType {
CASE_SENT
CLINIC_COMMENT
LAB_COMMENT
CASE_IMPORTANT
CASE_AMENDED
TASK_COMPLETED
}
enum LabCaseTabReadTarget {
CASES
TASKS
TREATMENT
}
model LabCaseActivity {
id String @id @default(uuid())
labCaseId String
type LabCaseActivityType
actorUserId String?
payload Json?
createdAt DateTime @default(now())
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
actorUser User? @relation(fields: [actorUserId], references: [id], onDelete: SetNull)
@@index([labCaseId, createdAt])
@@index([type, createdAt])
@@map("lab_case_activities")
}
model LabCaseUserReadState {
userId String
organizationId String
labCaseId String
lastReadAt DateTime
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
@@id([userId, organizationId, labCaseId])
@@index([userId, organizationId])
@@map("lab_case_user_read_states")
}
model LabCaseUserTabReadState {
userId String
organizationId String
tab LabCaseTabReadTarget
lastReadAt DateTime
@@id([userId, organizationId, tab])
@@map("lab_case_user_tab_read_states")
}
model Plan {
id String @id @default(uuid())
name String @unique // "Solo", "Small", "Medium", "Large", "Enterprise"