improvement: all demo bugs fixed. give me more baby.

This commit is contained in:
2026-07-08 02:53:47 +03:30
parent 86b1e3afff
commit 8d334833ff
23 changed files with 876 additions and 626 deletions

View File

@@ -0,0 +1,13 @@
-- Move the "important" flag from individual tasks to the case as a whole.
ALTER TABLE "lab_cases" ADD COLUMN "isImportant" BOOLEAN NOT NULL DEFAULT false;
-- Carry over existing importance: a case is important if any of its tasks were.
UPDATE "lab_cases" lc
SET "isImportant" = true
WHERE EXISTS (
SELECT 1 FROM "lab_case_tasks" t
WHERE t."labCaseId" = lc."id" AND t."isImportant" = true
);
DROP INDEX IF EXISTS "lab_case_tasks_labCaseId_isImportant_idx";
ALTER TABLE "lab_case_tasks" DROP COLUMN "isImportant";

View File

@@ -195,6 +195,7 @@ model LabCase {
sortOrder Int
destinationOrganizationId String?
sentAt DateTime?
isImportant Boolean @default(false)
treatment Treatment @relation(fields: [treatmentId], references: [id], onDelete: Cascade)
details LabCaseDetail[]
@@ -333,7 +334,6 @@ model LabCaseTask {
workflowStepCode String
stepOrder Int
stepLabel String
isImportant Boolean @default(false)
status LabTaskStatus @default(IN_PROGRESS)
lastStatusChangedByUserId String?
lastStatusChangedAt DateTime?
@@ -348,7 +348,6 @@ model LabCaseTask {
@@unique([labCaseId, treatmentDetailId, prosthesisTypeCode, stepOrder])
@@index([labCaseId, status])
@@index([labCaseId, isImportant])
@@map("lab_case_tasks")
}