improvement: tasks and cases feature updated based on the new prosthesis types and their steps. the whole assignment proccess removed from the flow.
This commit is contained in:
@@ -23,7 +23,9 @@ model User {
|
||||
sessions Session[] // 👈 ADD THIS - opposite relation for Session
|
||||
sentStaffInvites StaffInvitation[]
|
||||
sentOrganizationInvitations OrganizationInvitation[]
|
||||
assignedLabCaseTasks LabCaseTask[] @relation("LabCaseTaskAssignee")
|
||||
statusChangedLabCaseTasks LabCaseTask[] @relation("LabCaseTaskLastStatusChangedBy")
|
||||
labCaseTaskStatusEvents LabCaseTaskStatusEvent[]
|
||||
labCaseComments LabCaseComment[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -65,6 +67,7 @@ model Organization {
|
||||
appointments Appointment[]
|
||||
treatments Treatment[]
|
||||
labCaseSends LabCaseSend[]
|
||||
labCaseComments LabCaseComment[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@ -115,11 +118,15 @@ model Appointment {
|
||||
}
|
||||
|
||||
enum LabTaskStatus {
|
||||
PENDING
|
||||
IN_PROGRESS
|
||||
COMPLETED
|
||||
}
|
||||
|
||||
enum LabCaseCommentSide {
|
||||
LAB
|
||||
CLINIC
|
||||
}
|
||||
|
||||
model Treatment {
|
||||
id String @id @default(uuid())
|
||||
organizationId String
|
||||
@@ -194,6 +201,7 @@ model LabCase {
|
||||
sends LabCaseSend[]
|
||||
tasks LabCaseTask[]
|
||||
toothProsthesis LabCaseToothProsthesis[]
|
||||
comments LabCaseComment[]
|
||||
|
||||
@@index([treatmentId, sortOrder])
|
||||
@@map("lab_cases")
|
||||
@@ -306,31 +314,66 @@ model LabCaseTask {
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
treatmentDetailId String
|
||||
tooth String
|
||||
teeth Json
|
||||
treatmentType String
|
||||
prosthesisTypeCode String
|
||||
workflowStepCode String
|
||||
stepOrder Int
|
||||
stepLabel String
|
||||
assigneeUserId String?
|
||||
assignedAt DateTime?
|
||||
priority Int @default(3)
|
||||
status LabTaskStatus @default(PENDING)
|
||||
isImportant Boolean @default(false)
|
||||
status LabTaskStatus @default(IN_PROGRESS)
|
||||
lastStatusChangedByUserId String?
|
||||
lastStatusChangedAt DateTime?
|
||||
|
||||
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
|
||||
detail TreatmentDetail @relation(fields: [treatmentDetailId], references: [id], onDelete: Cascade)
|
||||
assignee User? @relation("LabCaseTaskAssignee", fields: [assigneeUserId], references: [id], onDelete: SetNull)
|
||||
lastStatusChangedBy User? @relation("LabCaseTaskLastStatusChangedBy", fields: [lastStatusChangedByUserId], references: [id], onDelete: SetNull)
|
||||
statusEvents LabCaseTaskStatusEvent[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([labCaseId, treatmentDetailId, tooth, stepOrder])
|
||||
@@unique([labCaseId, treatmentDetailId, prosthesisTypeCode, stepOrder])
|
||||
@@index([labCaseId, status])
|
||||
@@index([assigneeUserId, priority, createdAt])
|
||||
@@index([assignedAt, labCaseId, priority])
|
||||
@@index([labCaseId, isImportant])
|
||||
@@map("lab_case_tasks")
|
||||
}
|
||||
|
||||
model LabCaseTaskStatusEvent {
|
||||
id String @id @default(uuid())
|
||||
taskId String
|
||||
fromStatus LabTaskStatus?
|
||||
toStatus LabTaskStatus
|
||||
changedByUserId String?
|
||||
changedAt DateTime @default(now())
|
||||
|
||||
task LabCaseTask @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
||||
changedBy User? @relation(fields: [changedByUserId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([taskId, changedAt])
|
||||
@@map("lab_case_task_status_events")
|
||||
}
|
||||
|
||||
model LabCaseComment {
|
||||
id String @id @default(uuid())
|
||||
labCaseId String
|
||||
authorUserId String?
|
||||
authorOrganizationId String?
|
||||
authorSide LabCaseCommentSide
|
||||
body String
|
||||
visibleToClinic Boolean @default(false)
|
||||
|
||||
labCase LabCase @relation(fields: [labCaseId], references: [id], onDelete: Cascade)
|
||||
authorUser User? @relation(fields: [authorUserId], references: [id], onDelete: SetNull)
|
||||
authorOrganization Organization? @relation(fields: [authorOrganizationId], references: [id], onDelete: SetNull)
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([labCaseId, createdAt])
|
||||
@@map("lab_case_comments")
|
||||
}
|
||||
|
||||
model Plan {
|
||||
id String @id @default(uuid())
|
||||
name String @unique // "Solo", "Small", "Medium", "Large", "Enterprise"
|
||||
|
||||
Reference in New Issue
Block a user