mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
25254dd4c1
Add the tasks table, validation, service and routes (/api/tasks with a PATCH for partial updates / the done toggle, RBAC-gated) and the frontend data module. The tasks board now loads, creates and toggles real data (optimistic toggle with rollback). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
949 B
SQL
18 lines
949 B
SQL
CREATE TABLE "tasks" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"organization_id" text NOT NULL,
|
|
"title" text NOT NULL,
|
|
"assignee" text DEFAULT 'Unassigned' NOT NULL,
|
|
"due" text DEFAULT 'No due date' NOT NULL,
|
|
"priority" text NOT NULL,
|
|
"patient" text,
|
|
"notes" text,
|
|
"done" boolean DEFAULT false NOT NULL,
|
|
"created_by" text,
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "tasks" ADD CONSTRAINT "tasks_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "tasks" ADD CONSTRAINT "tasks_created_by_user_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "tasks_org_idx" ON "tasks" USING btree ("organization_id"); |