feature: Tasks tab added for lab organizations. tasks now can be assigned and their status can be updated by the assignee.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- Add task priority, timestamps, and Tasks tab permissions
|
||||
|
||||
ALTER TABLE "lab_case_tasks" ADD COLUMN "priority" INTEGER NOT NULL DEFAULT 3;
|
||||
ALTER TABLE "lab_case_tasks" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
ALTER TABLE "lab_case_tasks" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
CREATE INDEX "lab_case_tasks_assigneeUserId_priority_createdAt_idx"
|
||||
ON "lab_case_tasks"("assigneeUserId", "priority", "createdAt");
|
||||
|
||||
INSERT INTO "features" ("id", "name", "description", "organizationTypeId")
|
||||
VALUES (gen_random_uuid(), 'Tasks', 'Lab task inbox', NULL)
|
||||
ON CONFLICT ("name") DO NOTHING;
|
||||
|
||||
INSERT INTO "permissions" ("id", "name", "description", "featureId")
|
||||
SELECT gen_random_uuid(), v.name, NULL, f.id
|
||||
FROM (VALUES
|
||||
('TAB_TASKS_READ'),
|
||||
('TAB_TASKS_EDIT')
|
||||
) AS v(name)
|
||||
CROSS JOIN "features" f
|
||||
WHERE f.name = 'Tasks'
|
||||
ON CONFLICT ("name") DO NOTHING;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Track when a task was assigned (for sorting and display)
|
||||
|
||||
ALTER TABLE "lab_case_tasks" ADD COLUMN "assignedAt" TIMESTAMP(3);
|
||||
|
||||
CREATE INDEX "lab_case_tasks_assignedAt_labCaseId_priority_idx"
|
||||
ON "lab_case_tasks"("assignedAt" DESC, "labCaseId" ASC, "priority" DESC);
|
||||
Reference in New Issue
Block a user