feat: add care execution workspace

This commit is contained in:
2026-07-03 00:35:04 -07:00
parent df7c2efcc5
commit b6b15acc69
20 changed files with 4270 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
CREATE TYPE "public"."care_task_priority" AS ENUM('low', 'normal', 'high', 'urgent');--> statement-breakpoint
CREATE TYPE "public"."care_task_status" AS ENUM('pending', 'in_progress', 'completed', 'cancelled');--> statement-breakpoint
CREATE TYPE "public"."care_task_type" AS ENUM('daily_care', 'meal', 'medication', 'rehab', 'inspection', 'cleaning', 'other');--> statement-breakpoint
CREATE TABLE "care_tasks" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"organization_id" uuid NOT NULL,
"elder_id" uuid,
"title" text NOT NULL,
"care_type" "care_task_type" NOT NULL,
"priority" "care_task_priority" DEFAULT 'normal' NOT NULL,
"status" "care_task_status" DEFAULT 'pending' NOT NULL,
"scheduled_at" timestamp with time zone NOT NULL,
"assignee_label" text DEFAULT '' NOT NULL,
"execution_notes" text DEFAULT '' NOT NULL,
"completed_at" timestamp with time zone,
"created_by_account_id" uuid,
"completed_by_account_id" uuid,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "care_tasks" ADD CONSTRAINT "care_tasks_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "care_tasks" ADD CONSTRAINT "care_tasks_elder_id_elders_id_fk" FOREIGN KEY ("elder_id") REFERENCES "public"."elders"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "care_tasks" ADD CONSTRAINT "care_tasks_created_by_account_id_accounts_id_fk" FOREIGN KEY ("created_by_account_id") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "care_tasks" ADD CONSTRAINT "care_tasks_completed_by_account_id_accounts_id_fk" FOREIGN KEY ("completed_by_account_id") REFERENCES "public"."accounts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "care_tasks_queue_lookup" ON "care_tasks" USING btree ("organization_id","status","priority");--> statement-breakpoint
CREATE INDEX "care_tasks_schedule_lookup" ON "care_tasks" USING btree ("organization_id","scheduled_at");

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,13 @@
"when": 1783063091807,
"tag": "0003_gray_dust",
"breakpoints": true
},
{
"idx": 4,
"version": "7",
"when": 1783064001398,
"tag": "0004_silly_carnage",
"breakpoints": true
}
]
}