From b13ef61a705ab64a9b81df8bb65e0a261c772564 Mon Sep 17 00:00:00 2001 From: Stephan Terning Date: Wed, 14 Oct 2026 20:17:31 +0200 Subject: [PATCH 01/27] feat(tasks): resolve hierarchy inheritance and validate effective dependencies --- apps/api/drizzle/0004_brainy_spot.sql | 29 + apps/api/drizzle/meta/0004_snapshot.json | 1570 +++++++++ apps/api/drizzle/meta/_journal.json | 7 + apps/api/src/tasks/graph.test.ts | 11 + apps/api/src/tasks/graph.ts | 83 + apps/api/src/tasks/routes.ts | 13 +- apps/api/src/tasks/schema.ts | 20 +- apps/api/src/tasks/service.ts | 173 +- apps/api/src/tasks/tasks.integration.test.ts | 84 + .../decisions/0004-effective-task-graph.md | 31 + packages/shared/openapi.json | 2893 ++++++++++++++++- packages/shared/src/generated/api.ts | 456 +++ packages/shared/src/tasks.ts | 17 +- 13 files changed, 5244 insertions(+), 143 deletions(-) create mode 100644 apps/api/drizzle/0004_brainy_spot.sql create mode 100644 apps/api/drizzle/meta/0004_snapshot.json create mode 100644 apps/api/src/tasks/graph.test.ts create mode 100644 apps/api/src/tasks/graph.ts create mode 100644 docs/architecture/decisions/0004-effective-task-graph.md diff --git a/apps/api/drizzle/0004_brainy_spot.sql b/apps/api/drizzle/0004_brainy_spot.sql new file mode 100644 index 0000000..78e04f3 --- /dev/null +++ b/apps/api/drizzle/0004_brainy_spot.sql @@ -0,0 +1,29 @@ +CREATE TABLE "task_dependencies" ( + "blocked_task_id" uuid NOT NULL, + "blocking_task_id" uuid NOT NULL, + CONSTRAINT "task_dependencies_blocked_task_id_blocking_task_id_pk" PRIMARY KEY("blocked_task_id","blocking_task_id") +); +--> statement-breakpoint +CREATE TABLE "task_entity_exclusions" ( + "task_id" uuid NOT NULL, + "entity_id" uuid NOT NULL, + CONSTRAINT "task_entity_exclusions_task_id_entity_id_pk" PRIMARY KEY("task_id","entity_id") +); +--> statement-breakpoint +CREATE TABLE "task_relations" ( + "first_id" uuid NOT NULL, + "second_id" uuid NOT NULL, + CONSTRAINT "task_relations_first_id_second_id_pk" PRIMARY KEY("first_id","second_id") +); +--> statement-breakpoint +ALTER TABLE "tasks" ADD COLUMN "parent_id" uuid;--> statement-breakpoint +ALTER TABLE "tasks" ADD COLUMN "inherit" jsonb DEFAULT '[]'::jsonb NOT NULL;--> statement-breakpoint +ALTER TABLE "task_dependencies" ADD CONSTRAINT "task_dependencies_blocked_task_id_tasks_id_fk" FOREIGN KEY ("blocked_task_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_entity_exclusions" ADD CONSTRAINT "task_entity_exclusions_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_entity_exclusions" ADD CONSTRAINT "task_entity_exclusions_entity_id_planning_entities_id_fk" FOREIGN KEY ("entity_id") REFERENCES "public"."planning_entities"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_relations" ADD CONSTRAINT "task_relations_first_id_tasks_id_fk" FOREIGN KEY ("first_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "task_relations" ADD CONSTRAINT "task_relations_second_id_tasks_id_fk" FOREIGN KEY ("second_id") REFERENCES "public"."tasks"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "dependency_blocker_idx" ON "task_dependencies" USING btree ("blocking_task_id");--> statement-breakpoint +CREATE INDEX "relation_second_idx" ON "task_relations" USING btree ("second_id");--> statement-breakpoint +ALTER TABLE "tasks" ADD CONSTRAINT "tasks_parent_id_tasks_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."tasks"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint +CREATE INDEX "task_parent_idx" ON "tasks" USING btree ("parent_id"); \ No newline at end of file diff --git a/apps/api/drizzle/meta/0004_snapshot.json b/apps/api/drizzle/meta/0004_snapshot.json new file mode 100644 index 0000000..60dc9fa --- /dev/null +++ b/apps/api/drizzle/meta/0004_snapshot.json @@ -0,0 +1,1570 @@ +{ + "id": "9750cf1d-a796-4c2c-8066-0355dc1edc38", + "prevId": "149e2d32-dc44-4c97-9a08-ca17dbbc0a6c", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.installation": { + "name": "installation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.auth_challenges": { + "name": "auth_challenges", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "challenge": { + "name": "challenge", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "binding_hash": { + "name": "binding_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "context": { + "name": "context", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.passkey_credentials": { + "name": "passkey_credentials", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "transports": { + "name": "transports", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "credential_user_idx": { + "name": "credential_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "passkey_credentials_user_id_users_id_fk": { + "name": "passkey_credentials_user_id_users_id_fk", + "tableFrom": "passkey_credentials", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.households": { + "name": "households", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.memberships": { + "name": "memberships", + "schema": "", + "columns": { + "household_id": { + "name": "household_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "household_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "membership_user_idx": { + "name": "membership_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "memberships_household_id_households_id_fk": { + "name": "memberships_household_id_households_id_fk", + "tableFrom": "memberships", + "tableTo": "households", + "columnsFrom": [ + "household_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "memberships_user_id_users_id_fk": { + "name": "memberships_user_id_users_id_fk", + "tableFrom": "memberships", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "memberships_household_id_user_id_pk": { + "name": "memberships_household_id_user_id_pk", + "columns": [ + "household_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.security_events": { + "name": "security_events", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "actor_id": { + "name": "actor_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "subject_id": { + "name": "subject_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "security_events_actor_id_users_id_fk": { + "name": "security_events_actor_id_users_id_fk", + "tableFrom": "security_events", + "tableTo": "users", + "columnsFrom": [ + "actor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "security_events_subject_id_users_id_fk": { + "name": "security_events_subject_id_users_id_fk", + "tableFrom": "security_events", + "tableTo": "users", + "columnsFrom": [ + "subject_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sessions": { + "name": "sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "authenticated_at": { + "name": "authenticated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "session_user_idx": { + "name": "session_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "sessions_user_id_users_id_fk": { + "name": "sessions_user_id_users_id_fk", + "tableFrom": "sessions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.smtp_settings": { + "name": "smtp_settings", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "encrypted": { + "name": "encrypted", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account_tokens": { + "name": "account_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "purpose": { + "name": "purpose", + "type": "token_purpose", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "verifies_email": { + "name": "verifies_email", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "household_id": { + "name": "household_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "household_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "used_at": { + "name": "used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "account_tokens_user_id_users_id_fk": { + "name": "account_tokens_user_id_users_id_fk", + "tableFrom": "account_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "account_tokens_household_id_households_id_fk": { + "name": "account_tokens_household_id_households_id_fk", + "tableFrom": "account_tokens", + "tableTo": "households", + "columnsFrom": [ + "household_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified_at": { + "name": "email_verified_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "deployment_admin": { + "name": "deployment_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "language": { + "name": "language", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'en'" + }, + "theme": { + "name": "theme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'system'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_email_unique": { + "name": "users_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.planning_entities": { + "name": "planning_entities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "household_id": { + "name": "household_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "entity_kind", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'house'" + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'blue'" + }, + "archived": { + "name": "archived", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "latitude": { + "name": "latitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "longitude": { + "name": "longitude", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "radius": { + "name": "radius", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "sort_order": { + "name": "sort_order", + "type": "double precision", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "entity_household_idx": { + "name": "entity_household_idx", + "columns": [ + { + "expression": "household_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "planning_entities_household_id_households_id_fk": { + "name": "planning_entities_household_id_households_id_fk", + "tableFrom": "planning_entities", + "tableTo": "households", + "columnsFrom": [ + "household_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.planning_settings": { + "name": "planning_settings", + "schema": "", + "columns": { + "household_id": { + "name": "household_id", + "type": "uuid", + "primaryKey": true, + "notNull": true + }, + "size_thresholds": { + "name": "size_thresholds", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[60,240,480,1440]'::jsonb" + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + } + }, + "indexes": {}, + "foreignKeys": { + "planning_settings_household_id_households_id_fk": { + "name": "planning_settings_household_id_households_id_fk", + "tableFrom": "planning_settings", + "tableTo": "households", + "columnsFrom": [ + "household_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_activities": { + "name": "task_activities", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "task_id": { + "name": "task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "actor_id": { + "name": "actor_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "fields": { + "name": "fields", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "task_activities_task_id_tasks_id_fk": { + "name": "task_activities_task_id_tasks_id_fk", + "tableFrom": "task_activities", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_activities_actor_id_users_id_fk": { + "name": "task_activities_actor_id_users_id_fk", + "tableFrom": "task_activities", + "tableTo": "users", + "columnsFrom": [ + "actor_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_assignees": { + "name": "task_assignees", + "schema": "", + "columns": { + "task_id": { + "name": "task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "task_assignees_task_id_tasks_id_fk": { + "name": "task_assignees_task_id_tasks_id_fk", + "tableFrom": "task_assignees", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_assignees_user_id_users_id_fk": { + "name": "task_assignees_user_id_users_id_fk", + "tableFrom": "task_assignees", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "task_assignees_task_id_user_id_pk": { + "name": "task_assignees_task_id_user_id_pk", + "columns": [ + "task_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_dependencies": { + "name": "task_dependencies", + "schema": "", + "columns": { + "blocked_task_id": { + "name": "blocked_task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "blocking_task_id": { + "name": "blocking_task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "dependency_blocker_idx": { + "name": "dependency_blocker_idx", + "columns": [ + { + "expression": "blocking_task_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "task_dependencies_blocked_task_id_tasks_id_fk": { + "name": "task_dependencies_blocked_task_id_tasks_id_fk", + "tableFrom": "task_dependencies", + "tableTo": "tasks", + "columnsFrom": [ + "blocked_task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "task_dependencies_blocked_task_id_blocking_task_id_pk": { + "name": "task_dependencies_blocked_task_id_blocking_task_id_pk", + "columns": [ + "blocked_task_id", + "blocking_task_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_entities": { + "name": "task_entities", + "schema": "", + "columns": { + "task_id": { + "name": "task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "task_entities_task_id_tasks_id_fk": { + "name": "task_entities_task_id_tasks_id_fk", + "tableFrom": "task_entities", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_entities_entity_id_planning_entities_id_fk": { + "name": "task_entities_entity_id_planning_entities_id_fk", + "tableFrom": "task_entities", + "tableTo": "planning_entities", + "columnsFrom": [ + "entity_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "task_entities_task_id_entity_id_pk": { + "name": "task_entities_task_id_entity_id_pk", + "columns": [ + "task_id", + "entity_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_entity_exclusions": { + "name": "task_entity_exclusions", + "schema": "", + "columns": { + "task_id": { + "name": "task_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "entity_id": { + "name": "entity_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "task_entity_exclusions_task_id_tasks_id_fk": { + "name": "task_entity_exclusions_task_id_tasks_id_fk", + "tableFrom": "task_entity_exclusions", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_entity_exclusions_entity_id_planning_entities_id_fk": { + "name": "task_entity_exclusions_entity_id_planning_entities_id_fk", + "tableFrom": "task_entity_exclusions", + "tableTo": "planning_entities", + "columnsFrom": [ + "entity_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "task_entity_exclusions_task_id_entity_id_pk": { + "name": "task_entity_exclusions_task_id_entity_id_pk", + "columns": [ + "task_id", + "entity_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.task_relations": { + "name": "task_relations", + "schema": "", + "columns": { + "first_id": { + "name": "first_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "second_id": { + "name": "second_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "relation_second_idx": { + "name": "relation_second_idx", + "columns": [ + { + "expression": "second_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "task_relations_first_id_tasks_id_fk": { + "name": "task_relations_first_id_tasks_id_fk", + "tableFrom": "task_relations", + "tableTo": "tasks", + "columnsFrom": [ + "first_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_relations_second_id_tasks_id_fk": { + "name": "task_relations_second_id_tasks_id_fk", + "tableFrom": "task_relations", + "tableTo": "tasks", + "columnsFrom": [ + "second_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "task_relations_first_id_second_id_pk": { + "name": "task_relations_first_id_second_id_pk", + "columns": [ + "first_id", + "second_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tasks": { + "name": "tasks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "household_id": { + "name": "household_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "inherit": { + "name": "inherit", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "status": { + "name": "status", + "type": "task_status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'todo'" + }, + "planning_bucket": { + "name": "planning_bucket", + "type": "planning_bucket", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'someday'" + }, + "preceding_column": { + "name": "preceding_column", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "epic_id": { + "name": "epic_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "high": { + "name": "high", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "size": { + "name": "size", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "estimate_minutes": { + "name": "estimate_minutes", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "start_date": { + "name": "start_date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_time": { + "name": "start_time", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deadline_date": { + "name": "deadline_date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "deadline_time": { + "name": "deadline_time", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "field_versions": { + "name": "field_versions", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, + "sort_order": { + "name": "sort_order", + "type": "double precision", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_by": { + "name": "created_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "completed_at": { + "name": "completed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "completed_by": { + "name": "completed_by", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "trashed_at": { + "name": "trashed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "task_household_order_idx": { + "name": "task_household_order_idx", + "columns": [ + { + "expression": "household_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "sort_order", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "task_epic_idx": { + "name": "task_epic_idx", + "columns": [ + { + "expression": "epic_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "task_parent_idx": { + "name": "task_parent_idx", + "columns": [ + { + "expression": "parent_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "tasks_household_id_households_id_fk": { + "name": "tasks_household_id_households_id_fk", + "tableFrom": "tasks", + "tableTo": "households", + "columnsFrom": [ + "household_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tasks_parent_id_tasks_id_fk": { + "name": "tasks_parent_id_tasks_id_fk", + "tableFrom": "tasks", + "tableTo": "tasks", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + }, + "tasks_epic_id_planning_entities_id_fk": { + "name": "tasks_epic_id_planning_entities_id_fk", + "tableFrom": "tasks", + "tableTo": "planning_entities", + "columnsFrom": [ + "epic_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tasks_created_by_users_id_fk": { + "name": "tasks_created_by_users_id_fk", + "tableFrom": "tasks", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "tasks_completed_by_users_id_fk": { + "name": "tasks_completed_by_users_id_fk", + "tableFrom": "tasks", + "tableTo": "users", + "columnsFrom": [ + "completed_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.household_role": { + "name": "household_role", + "schema": "public", + "values": [ + "admin", + "member" + ] + }, + "public.token_purpose": { + "name": "token_purpose", + "schema": "public", + "values": [ + "bootstrap", + "invite", + "recovery", + "verify_email" + ] + }, + "public.planning_bucket": { + "name": "planning_bucket", + "schema": "public", + "values": [ + "someday", + "within_year", + "within_month", + "ready" + ] + }, + "public.entity_kind": { + "name": "entity_kind", + "schema": "public", + "values": [ + "epic", + "place", + "resource", + "tag" + ] + }, + "public.task_status": { + "name": "task_status", + "schema": "public", + "values": [ + "todo", + "in_progress", + "done" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json index 8bbb1b8..dfb5c66 100644 --- a/apps/api/drizzle/meta/_journal.json +++ b/apps/api/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1791993728147, "tag": "0003_easy_elektra", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1792001240021, + "tag": "0004_brainy_spot", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/api/src/tasks/graph.test.ts b/apps/api/src/tasks/graph.test.ts new file mode 100644 index 0000000..9c6c9ed --- /dev/null +++ b/apps/api/src/tasks/graph.test.ts @@ -0,0 +1,11 @@ +import { expect, it } from 'vitest'; +import type { TaskFields } from '@tendly/shared'; +import { resolveGraph, type GraphNode } from './graph.js'; +it('resolves thousands of nesting levels without a recursive call-stack limit', () => { + const local: TaskFields = { parentId: null, inherit: [], placeExclusions: [], resourceExclusions: [], tagExclusions: [], blockers: [], related: [], title: 'Deep task', description: '', column: 'todo', epicId: null, high: true, size: null, estimateMinutes: null, startDate: null, startTime: null, deadlineDate: null, deadlineTime: null, assignees: [], places: [], resources: [], tags: [] }; + const nodes: GraphNode[] = Array.from({ length: 3000 }, (_, i) => ({ id: String(i), trashed: false, local: { ...local, parentId: i ? String(i - 1) : null, high: !i, inherit: i ? ['high'] : [] } })); + const graph = resolveGraph(nodes, 'UTC'); + graph.validateDependencies(); + expect(graph.details('2999')).toMatchObject({ high: true, available: true }); + expect(graph.details('0').unfinishedDescendants).toBe(2999); +}); diff --git a/apps/api/src/tasks/graph.ts b/apps/api/src/tasks/graph.ts new file mode 100644 index 0000000..8a39e47 --- /dev/null +++ b/apps/api/src/tasks/graph.ts @@ -0,0 +1,83 @@ +import { type TaskFields, type Task } from '@tendly/shared'; +import { availability, dateInstant } from './domain.js'; +import { AccountError } from '../accounts/errors.js'; +export type GraphNode = { id: string; local: TaskFields; trashed: boolean }; +const sets = ['places', 'resources', 'tags'] as const; +const exclusions = { places: 'placeExclusions', resources: 'resourceExclusions', tags: 'tagExclusions' } as const; +export const emptyInherited = { epicId: null, high: false, startDate: null, startTime: null, deadlineDate: null, deadlineTime: null, assignees: [], places: [], resources: [], tags: [] }; +export function resolveGraph(nodes: GraphNode[], timezone: string) { + const byId = new Map(nodes.map(node => [node.id, node])); + const children = new Map(); + const order: string[] = []; + for (const node of nodes) { + const parent = node.local.parentId; + if (!parent) order.push(node.id); + else { + if (!byId.has(parent)) throw new AccountError('invalid_task_reference'); + const siblings = children.get(parent) ?? []; siblings.push(node.id); children.set(parent, siblings); + } + } + // Iteration rather than recursive JS calls keeps deeply nested valid trees usable. + for (let at = 0; at < order.length; at++) for (const child of children.get(order[at]!) ?? []) order.push(child); + if (order.length !== nodes.length) throw new AccountError('task_cycle'); + const effective = new Map(); + const blockers = new Map>(); + const unfinished = new Map(); + for (const id of order) { + const local = byId.get(id)!.local; + const parent = local.parentId ? effective.get(local.parentId)! : emptyInherited; + const next = { ...local }; + for (const key of local.inherit) { + if (key === 'startDate') { next.startDate = parent.startDate; next.startTime = parent.startTime; } + else if (key === 'deadlineDate') { next.deadlineDate = parent.deadlineDate; next.deadlineTime = parent.deadlineTime; } + else if (key === 'epicId') next.epicId = parent.epicId; + else if (key === 'high') next.high = parent.high; + else next.assignees = parent.assignees; + } + for (const key of sets) next[key] = [...new Set([...parent[key].filter(item => !local[exclusions[key]].includes(item)), ...local[key]])].sort(); + effective.set(id, next); + blockers.set(id, new Set([...(local.parentId ? blockers.get(local.parentId)! : []), ...local.blockers])); + } + for (const id of [...order].reverse()) unfinished.set(id, (children.get(id) ?? []).reduce((sum, child) => { + const node = byId.get(child)!; + return sum + (node.trashed ? 0 : (node.local.column === 'done' ? 0 : 1) + unfinished.get(child)!); + }, 0)); + function link(id: string) { const node = byId.get(id)!; return { id, title: node.local.title, column: node.local.column }; } + function details(id: string) { + const node = byId.get(id)!, value = effective.get(id)!; + const parent = value.parentId ? effective.get(value.parentId)! : emptyInherited; + const ancestors: Task['ancestors'] = []; + for (let p = value.parentId; p; p = byId.get(p)!.local.parentId) ancestors.push(link(p)); + const direct = (children.get(id) ?? []).filter(child => !byId.get(child)!.trashed).map(link); + const effectiveBlockers = [...blockers.get(id)!].map(blocker => { + const target = byId.get(blocker); + return { id: blocker, title: target?.local.title ?? null, complete: !!target && !target.trashed && target.local.column === 'done', inherited: !node.local.blockers.includes(blocker) }; + }); + const dates = availability(value, timezone); + return { + ...value, local: node.local, inheritedValues: parent, ancestors: ancestors.reverse(), children: direct, + relatedTasks: node.local.related.filter(peer => byId.has(peer)).map(link), effectiveBlockers, ...dates, available: dates.available && effectiveBlockers.every(b => b.complete), + progress: { done: direct.filter(c => c.column === 'done').length, total: direct.length }, + unfinishedDescendants: unfinished.get(id)!, + deadlineBeyondParent: !!value.parentId && !!value.deadlineDate && !!parent.deadlineDate && dateInstant(value.deadlineDate, value.deadlineTime, timezone, true) > dateInstant(parent.deadlineDate, parent.deadlineTime, timezone, true), + }; + } + function validateDependencies() { + // Kahn traversal validates the effective graph, including ancestor-derived edges. + // Availability intentionally does NOT traverse those blockers' own dependencies. + const remaining = new Map(); + const dependents = new Map(); + for (const id of order) { + const targets = [...blockers.get(id)!].filter(target => byId.has(target)); + remaining.set(id, targets.length); + for (const target of targets) { const list = dependents.get(target) ?? []; list.push(id); dependents.set(target, list); } + } + const ready = order.filter(id => remaining.get(id) === 0); + for (let at = 0; at < ready.length; at++) for (const dependent of dependents.get(ready[at]!) ?? []) { + const count = remaining.get(dependent)! - 1; remaining.set(dependent, count); + if (!count) ready.push(dependent); + } + if (ready.length !== order.length) throw new AccountError('dependency_cycle'); + } + return { details, validateDependencies }; +} diff --git a/apps/api/src/tasks/routes.ts b/apps/api/src/tasks/routes.ts index a5949c1..8c327d8 100644 --- a/apps/api/src/tasks/routes.ts +++ b/apps/api/src/tasks/routes.ts @@ -17,15 +17,18 @@ export async function registerTaskRoutes(server: FastifyInstance, accounts: Acco return current; }; app.get('/api/v1/households/:householdId/tasks', { - schema: { params: scope, querystring: z.object({ view: z.enum(['now', 'board']).default('board'), offset: z.coerce.number().int().min(0).default(0), limit: z.coerce.number().int().min(1).max(100).default(100) }), response: { 200: z.object({ items: z.array(taskSchema), nextOffset: z.number().nullable() }) } }, - }, async request => service.list(await actor(request), request.params.householdId, request.query.view, request.query.offset, request.query.limit)); + schema: { params: scope, querystring: z.object({ view: z.enum(['now', 'board']).default('board'), offset: z.coerce.number().int().min(0).default(0), search: z.string().max(200).default(''), includeSubtasks: z.enum(['true', 'false']).default('false'), parentId: z.uuid().optional(), limit: z.coerce.number().int().min(1).max(100).default(100) }), response: { 200: z.object({ items: z.array(taskSchema), nextOffset: z.number().nullable() }) } }, + }, async request => service.list(await actor(request), request.params.householdId, request.query.view, request.query.offset, request.query.limit, request.query.includeSubtasks === 'true', request.query.parentId, request.query.search)); app.get('/api/v1/households/:householdId/tasks/:id', { schema: { params: item, response: { 200: taskSchema } } }, async request => { - const household = await service.scope(service.db, await actor(request), request.params.householdId); - return service.get(service.db, household.id, request.params.id, household.timezone); + const current = await actor(request); + return service.db.transaction(async tx => { + const household = await service.scope(tx, current, request.params.householdId); + return service.get(tx, household.id, request.params.id, household.timezone); + }, { isolationLevel: 'repeatable read' }); }); app.post('/api/v1/households/:householdId/tasks', { schema: { params: scope, body: taskCreateSchema, response: { 200: taskSchema } } }, async request => service.create(await actor(request), request.params.householdId, request.body)); app.patch('/api/v1/households/:householdId/tasks/:id', { schema: { params: item, body: taskPatchSchema, response: { 200: taskSchema, 409: z.union([taskConflictSchema, errorSchema]) } } }, async (request, reply) => { - try { return await service.patch(await actor(request), request.params.householdId, request.params.id, request.body.baseVersion, request.body.changes, request.body.confirmUnavailable); } + try { return await service.patch(await actor(request), request.params.householdId, request.params.id, request.body.baseVersion, request.body.changes, request.body.confirmUnavailable, request.body.confirmDescendants); } catch (error) { if (error instanceof TaskConflict) return reply.code(409).send({ error: 'task_conflict' as const, fields: error.fields, current: error.current }); throw error; diff --git a/apps/api/src/tasks/schema.ts b/apps/api/src/tasks/schema.ts index 8d78733..c05c74e 100644 --- a/apps/api/src/tasks/schema.ts +++ b/apps/api/src/tasks/schema.ts @@ -1,4 +1,4 @@ -import { pgTable, pgEnum, uuid, text, integer, boolean, timestamp, doublePrecision, jsonb, primaryKey, index } from 'drizzle-orm/pg-core'; +import { pgTable, pgEnum, uuid, text, integer, boolean, timestamp, doublePrecision, jsonb, primaryKey, index, type AnyPgColumn } from 'drizzle-orm/pg-core'; import { households, users } from '../accounts/schema.js'; export const kindEnum = pgEnum('entity_kind', ['epic', 'place', 'resource', 'tag']); export const statusEnum = pgEnum('task_status', ['todo', 'in_progress', 'done']); @@ -15,6 +15,8 @@ export const entities = pgTable('planning_entities', { export const tasks = pgTable('tasks', { id: uuid('id').primaryKey().defaultRandom(), householdId: uuid('household_id').notNull().references(() => households.id, { onDelete: 'cascade' }), + parentId: uuid('parent_id').references((): AnyPgColumn => tasks.id, { onDelete: 'restrict' }), + inherit: jsonb('inherit').$type<('epicId' | 'high' | 'startDate' | 'deadlineDate' | 'assignees')[]>().notNull().default([]), title: text('title').notNull(), description: text('description').notNull().default(''), status: statusEnum('status').notNull().default('todo'), bucket: bucketEnum('planning_bucket').notNull().default('someday'), precedingColumn: text('preceding_column'), @@ -30,7 +32,7 @@ export const tasks = pgTable('tasks', { createdBy: uuid('created_by').references(() => users.id, { onDelete: 'set null' }), completedAt: timestamp('completed_at', { withTimezone: true }), completedBy: uuid('completed_by').references(() => users.id, { onDelete: 'set null' }), archivedAt: timestamp('archived_at', { withTimezone: true }), trashedAt: timestamp('trashed_at', { withTimezone: true }), -}, t => [index('task_household_order_idx').on(t.householdId, t.order), index('task_epic_idx').on(t.epicId)]); +}, t => [index('task_household_order_idx').on(t.householdId, t.order), index('task_epic_idx').on(t.epicId), index('task_parent_idx').on(t.parentId)]); export const taskEntities = pgTable('task_entities', { taskId: uuid('task_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }), entityId: uuid('entity_id').notNull().references(() => entities.id, { onDelete: 'cascade' }), @@ -50,3 +52,17 @@ export const planningSettings = pgTable('planning_settings', { thresholds: jsonb('size_thresholds').$type<[number, number, number, number]>().notNull().default([60, 240, 480, 1440]), version: integer('version').notNull().default(1), }); + +export const taskEntityExclusions = pgTable('task_entity_exclusions', { + taskId: uuid('task_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }), + entityId: uuid('entity_id').notNull().references(() => entities.id, { onDelete: 'cascade' }), +}, t => [primaryKey({ columns: [t.taskId, t.entityId] })]); +export const taskDependencies = pgTable('task_dependencies', { + blockedTaskId: uuid('blocked_task_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }), + // Retain the identity after permanent deletion; a missing blocker is unresolved. + blockingTaskId: uuid('blocking_task_id').notNull(), +}, t => [primaryKey({ columns: [t.blockedTaskId, t.blockingTaskId] }), index('dependency_blocker_idx').on(t.blockingTaskId)]); +export const taskRelations = pgTable('task_relations', { + firstId: uuid('first_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }), + secondId: uuid('second_id').notNull().references(() => tasks.id, { onDelete: 'cascade' }), +}, t => [primaryKey({ columns: [t.firstId, t.secondId] }), index('relation_second_idx').on(t.secondId)]); diff --git a/apps/api/src/tasks/service.ts b/apps/api/src/tasks/service.ts index b2a829a..4ca3deb 100644 --- a/apps/api/src/tasks/service.ts +++ b/apps/api/src/tasks/service.ts @@ -1,12 +1,13 @@ -import { and, asc, eq, gt, inArray, isNull, max } from 'drizzle-orm'; +import { and, asc, eq, inArray, isNull, max, or, sql } from 'drizzle-orm'; import { z } from 'zod'; -import { taskFields, taskSchema, entitySchema, type Task, type TaskChanges, type TaskFields, type taskCreateSchema, type entityCreateSchema, type entityPatchSchema } from '@tendly/shared'; +import { taskFields, taskSchema, entitySchema, inheritedFields, type Task, type TaskChanges, type TaskFields, type taskCreateSchema, type entityCreateSchema, type entityPatchSchema } from '@tendly/shared'; import type { Database, QueryDatabase, Transaction } from '../accounts/database.js'; import { householdAccess, type Actor } from '../accounts/access.js'; import { households, memberships } from '../accounts/schema.js'; import { AccountError } from '../accounts/errors.js'; -import { entities, tasks, taskEntities, taskAssignees, taskActivities, planningSettings } from './schema.js'; -import { availability, moveTaskToColumn, suggestSize, taskColumn } from './domain.js'; +import { entities, tasks, taskEntities, taskAssignees, taskActivities, planningSettings, taskEntityExclusions, taskDependencies, taskRelations } from './schema.js'; +import { resolveGraph } from './graph.js'; +import { moveTaskToColumn, suggestSize, taskColumn } from './domain.js'; type Row = typeof tasks.$inferSelect; export class TaskConflict extends AccountError { @@ -26,51 +27,69 @@ export class TaskService { const [row] = await db.select().from(planningSettings).where(eq(planningSettings.householdId, householdId)); return row ? { version: row.version, thresholds: row.thresholds } : { version: 0, thresholds: [60, 240, 480, 1440] as [number, number, number, number] }; } + async graph(db: QueryDatabase, householdId: string, timezone: string) { + const rows = await db.select().from(tasks).where(eq(tasks.householdId, householdId)).orderBy(asc(tasks.order)); + const links = await db.select({ taskId: taskEntities.taskId, id: entities.id, kind: entities.kind }).from(taskEntities).innerJoin(tasks, eq(tasks.id, taskEntities.taskId)).innerJoin(entities, eq(entities.id, taskEntities.entityId)).where(eq(tasks.householdId, householdId)); + const exclusions = await db.select({ taskId: taskEntityExclusions.taskId, id: entities.id, kind: entities.kind }).from(taskEntityExclusions).innerJoin(tasks, eq(tasks.id, taskEntityExclusions.taskId)).innerJoin(entities, eq(entities.id, taskEntityExclusions.entityId)).where(eq(tasks.householdId, householdId)); + const assignments = await db.select({ taskId: taskAssignees.taskId, userId: taskAssignees.userId }).from(taskAssignees).innerJoin(tasks, eq(tasks.id, taskAssignees.taskId)).where(eq(tasks.householdId, householdId)); + const dependencies = await db.select({ blocked: taskDependencies.blockedTaskId, blocker: taskDependencies.blockingTaskId }).from(taskDependencies).innerJoin(tasks, eq(tasks.id, taskDependencies.blockedTaskId)).where(eq(tasks.householdId, householdId)); + const relations = await db.select({ first: taskRelations.firstId, second: taskRelations.secondId }).from(taskRelations).innerJoin(tasks, eq(tasks.id, taskRelations.firstId)).where(eq(tasks.householdId, householdId)); + const collect = (records: T[], owner: (record: T) => string) => { + const map = new Map(); + for (const record of records) { const key = owner(record); const list = map.get(key) ?? []; list.push(record); map.set(key, list); } + return map; + }; + const localLinks = collect(links, l => l.taskId), localExclusions = collect(exclusions, l => l.taskId); + const localAssignments = collect(assignments, a => a.taskId), localDependencies = collect(dependencies, d => d.blocked); + const related = new Map(); + for (const pair of relations) { related.set(pair.first, [...(related.get(pair.first) ?? []), pair.second]); related.set(pair.second, [...(related.get(pair.second) ?? []), pair.first]); } + const graph = resolveGraph(rows.map(row => ({ id: row.id, trashed: !!row.trashedAt, local: taskFields.parse({ + ...row, column: taskColumn(row), + assignees: (localAssignments.get(row.id) ?? []).map(a => a.userId).sort(), + ...Object.fromEntries(['place', 'resource', 'tag'].flatMap(kind => [ + [kind + 's', (localLinks.get(row.id) ?? []).filter(l => l.kind === kind).map(l => l.id).sort()], + [kind + 'Exclusions', (localExclusions.get(row.id) ?? []).filter(l => l.kind === kind).map(l => l.id).sort()], + ])), + blockers: (localDependencies.get(row.id) ?? []).map(d => d.blocker).sort(), related: (related.get(row.id) ?? []).sort(), + }) })), timezone); + const byId = new Map(rows.map(row => [row.id, row])); + return { rows, graph, task: (id: string) => { + const row = byId.get(id); + if (!row || row.trashedAt) throw new AccountError('task_not_found', 404); + return taskSchema.parse({ ...row, ...graph.details(id), createdAt: row.createdAt.toISOString(), updatedAt: row.updatedAt.toISOString(), completedAt: row.completedAt?.toISOString() ?? null }); + } }; + } async hydrate(db: QueryDatabase, rows: Row[], timezone: string): Promise { if (!rows.length) return []; - const ids = rows.map(r => r.id); - const links = await db.select({ taskId: taskEntities.taskId, id: entities.id, kind: entities.kind }).from(taskEntities).innerJoin(entities, eq(entities.id, taskEntities.entityId)).where(inArray(taskEntities.taskId, ids)); - const assignees = await db.select().from(taskAssignees).where(inArray(taskAssignees.taskId, ids)); - return rows.map(row => { - const column = taskColumn(row); - return taskSchema.parse({ - ...row, column, ...availability({ ...row, column }, timezone), - createdAt: row.createdAt.toISOString(), updatedAt: row.updatedAt.toISOString(), completedAt: row.completedAt?.toISOString() ?? null, - assignees: assignees.filter(a => a.taskId === row.id).map(a => a.userId).sort(), - places: links.filter(l => l.taskId === row.id && l.kind === 'place').map(l => l.id).sort(), - resources: links.filter(l => l.taskId === row.id && l.kind === 'resource').map(l => l.id).sort(), - tags: links.filter(l => l.taskId === row.id && l.kind === 'tag').map(l => l.id).sort(), - }); - }); + const context = await this.graph(db, rows[0]!.householdId, timezone); + return rows.map(row => context.task(row.id)); } async get(db: QueryDatabase, householdId: string, id: string, timezone: string) { - const [row] = await db.select().from(tasks).where(and(eq(tasks.id, id), eq(tasks.householdId, householdId), isNull(tasks.trashedAt))); - if (!row) throw new AccountError('task_not_found', 404); - return (await this.hydrate(db, [row], timezone))[0]!; - } - async list(actor: Actor, householdId: string, view: 'now' | 'board', offset: number, limit: number) { - const household = await this.scope(this.db, actor, householdId); - const selected: Row[] = []; - let cursor = -1, matched = 0, more = true; - // Bound each scan; filter before pagination. There is no silent household task cap. - // Stage 5's filter compiler will extend this same effective-result boundary. - while (more && selected.length <= limit) { - const batch = await this.db.select().from(tasks).where(and(eq(tasks.householdId, householdId), isNull(tasks.trashedAt), isNull(tasks.archivedAt), gt(tasks.order, cursor))).orderBy(asc(tasks.order)).limit(256); - more = batch.length === 256; - for (const row of batch) { - cursor = row.order; - const column = taskColumn(row); - if (view === 'now' && (!['within_month', 'todo', 'in_progress'].includes(column) || !availability({ ...row, column }, household.timezone).available)) continue; - if (matched++ >= offset) selected.push(row); + return (await this.graph(db, householdId, timezone)).task(id); + } + async list(actor: Actor, householdId: string, view: 'now' | 'board', offset: number, limit: number, includeSubtasks = false, parentId?: string, search = '') { + // One snapshot prevents mixed parent/child values during concurrent edits. + return this.db.transaction(async tx => { + const household = await this.scope(tx, actor, householdId); + const context = await this.graph(tx, householdId, household.timezone); + const selected: Task[] = []; + let matched = 0; + for (const row of context.rows) { + if (row.trashedAt || row.archivedAt || !row.title.toLocaleLowerCase().includes(search.toLocaleLowerCase())) continue; + if (parentId !== undefined ? row.parentId !== parentId : view === 'board' && !includeSubtasks && row.parentId !== null) continue; + const task = context.task(row.id); + if (view === 'now' && (!['within_month', 'todo', 'in_progress'].includes(task.column) || !task.available)) continue; + if (matched++ >= offset) selected.push(task); if (selected.length > limit) break; } - } - return { items: await this.hydrate(this.db, selected.slice(0, limit), household.timezone), nextOffset: selected.length > limit ? offset + limit : null }; + return { items: selected.slice(0, limit), nextOffset: selected.length > limit ? offset + limit : null }; + }, { isolationLevel: 'repeatable read' }); } async validate(db: QueryDatabase, householdId: string, value: TaskFields, previous?: Task) { if ((!value.startDate && value.startTime) || (!value.deadlineDate && value.deadlineTime)) throw new AccountError('date_required'); const expected = [ ...(value.epicId ? [{ id: value.epicId, kind: 'epic' }] : []), + ...value.placeExclusions.map(id => ({ id, kind: 'place' })), ...value.resourceExclusions.map(id => ({ id, kind: 'resource' })), ...value.tagExclusions.map(id => ({ id, kind: 'tag' })), ...value.places.map(id => ({ id, kind: 'place' })), ...value.resources.map(id => ({ id, kind: 'resource' })), ...value.tags.map(id => ({ id, kind: 'tag' })), ]; const records = expected.length ? await db.select().from(entities).where(and(eq(entities.householdId, householdId), inArray(entities.id, expected.map(e => e.id)))) : []; @@ -79,6 +98,21 @@ export class TaskService { if (!record) throw new AccountError('invalid_task_reference'); if (record.archived && (item.kind === 'epic' ? previous?.epicId !== item.id : ![...(previous?.places ?? []), ...(previous?.resources ?? []), ...(previous?.tags ?? [])].includes(item.id))) throw new AccountError('entity_archived'); } + const references = [...new Set([...(value.parentId ? [value.parentId] : []), ...value.blockers, ...value.related])]; + if (references.length) { + const found = await db.select({ id: tasks.id }).from(tasks).where(and(eq(tasks.householdId, householdId), inArray(tasks.id, references), isNull(tasks.trashedAt))); + const known = new Set(found.map(t => t.id)); + // Previously deleted blockers remain removable and unresolved, never silently completed. + if (references.some(id => !known.has(id) && !(previous?.local.blockers.includes(id) && value.blockers.includes(id) && value.parentId !== id && !value.related.includes(id)))) throw new AccountError('invalid_task_reference'); + if (previous && value.related.includes(previous.id)) throw new AccountError('invalid_task_reference'); + } + if (previous && value.parentId && value.parentId !== previous.parentId) { + const descendants = await db.execute<{ id: string }>(sql`WITH RECURSIVE descendants AS ( + SELECT id FROM tasks WHERE id = ${previous.id} AND household_id = ${householdId} + UNION SELECT t.id FROM tasks t JOIN descendants d ON t.parent_id = d.id WHERE t.household_id = ${householdId} + ) SELECT id FROM descendants WHERE id = ${value.parentId}`); + if (descendants.rows.length) throw new AccountError('task_cycle'); + } if (value.assignees.length) { const members = await db.select().from(memberships).where(and(eq(memberships.householdId, householdId), inArray(memberships.userId, value.assignees))); if (new Set(value.assignees).size !== members.length) throw new AccountError('invalid_task_reference'); @@ -91,17 +125,35 @@ export class TaskService { await db.delete(taskAssignees).where(eq(taskAssignees.taskId, id)); if (value.assignees.length) await db.insert(taskAssignees).values([...new Set(value.assignees)].map(userId => ({ taskId: id, userId }))); } + async graphCollections(db: Transaction, id: string, value: TaskFields, actorId: string) { + await db.delete(taskEntityExclusions).where(eq(taskEntityExclusions.taskId, id)); + const excluded = [...new Set([...value.placeExclusions, ...value.resourceExclusions, ...value.tagExclusions])]; + if (excluded.length) await db.insert(taskEntityExclusions).values(excluded.map(entityId => ({ taskId: id, entityId }))); + await db.delete(taskDependencies).where(eq(taskDependencies.blockedTaskId, id)); + if (value.blockers.length) await db.insert(taskDependencies).values([...new Set(value.blockers)].map(blockingTaskId => ({ blockedTaskId: id, blockingTaskId }))); + const old = await db.select().from(taskRelations).where(or(eq(taskRelations.firstId, id), eq(taskRelations.secondId, id))); + const previous = old.map(pair => pair.firstId === id ? pair.secondId : pair.firstId); + const changed = new Set([...previous.filter(peer => !value.related.includes(peer)), ...value.related.filter(peer => !previous.includes(peer))]); + if (!changed.size) return; + await db.delete(taskRelations).where(or(eq(taskRelations.firstId, id), eq(taskRelations.secondId, id))); + if (value.related.length) await db.insert(taskRelations).values([...new Set(value.related)].map(peer => { const [firstId, secondId] = [id, peer].sort(); return { firstId: firstId!, secondId: secondId! }; })); + for (const peer of changed) { + const [row] = await db.select().from(tasks).where(eq(tasks.id, peer)); + if (!row) continue; + await db.update(tasks).set({ version: row.version + 1, fieldVersions: { ...row.fieldVersions, related: row.version + 1 }, updatedAt: new Date() }).where(eq(tasks.id, peer)); + await db.insert(taskActivities).values({ taskId: peer, actorId, version: row.version + 1, fields: ['related'] }); + } + } values(value: TaskFields) { - const { column: _column, places: _places, resources: _resources, tags: _tags, assignees: _assignees, ...plain } = value; - void _column; void _places; void _resources; void _tags; void _assignees; + const { blockers: _blockers, related: _related, placeExclusions: _pe, resourceExclusions: _re, tagExclusions: _te, column: _column, places: _places, resources: _resources, tags: _tags, assignees: _assignees, ...plain } = value; + void _blockers; void _related; void _pe; void _re; void _te; void _column; void _places; void _resources; void _tags; void _assignees; return plain; } async create(actor: Actor, householdId: string, input: z.infer) { return this.db.transaction(async tx => { const household = await this.scope(tx, actor, householdId, true); - const value = taskFields.parse({ description: '', column: 'someday', epicId: null, high: false, size: null, estimateMinutes: null, startDate: null, startTime: null, deadlineDate: null, deadlineTime: null, assignees: [], places: [], resources: [], tags: [], ...input }); + const value = taskFields.parse({ parentId: null, inherit: input.parentId ? inheritedFields.filter(field => input[field] === undefined) : [], placeExclusions: [], resourceExclusions: [], tagExclusions: [], blockers: [], related: [], description: '', column: 'someday', epicId: null, high: false, size: null, estimateMinutes: null, startDate: null, startTime: null, deadlineDate: null, deadlineTime: null, assignees: [], places: [], resources: [], tags: [], ...input }); await this.validate(tx, householdId, value); - if (value.column === 'in_progress' && !availability(value, household.timezone).available && !input.confirmUnavailable) throw new AccountError('confirm_unavailable', 409); if (!value.size && value.estimateMinutes) value.size = suggestSize(value.estimateMinutes, (await this.settings(tx, householdId)).thresholds); const [last] = await tx.select({ value: max(tasks.order) }).from(tasks).where(eq(tasks.householdId, householdId)); const workflow = moveTaskToColumn({ status: 'todo', bucket: 'someday', precedingColumn: null }, value.column); @@ -110,17 +162,26 @@ export class TaskService { completedAt: value.column === 'done' ? new Date() : null, completedBy: value.column === 'done' ? actor.user.id : null, }).returning(); await this.collections(tx, row!.id, value); + await this.graphCollections(tx, row!.id, value, actor.user.id); + const created = await this.graph(tx, householdId, household.timezone); + created.graph.validateDependencies(); + if (value.column === 'in_progress' && !created.task(row!.id).available && !input.confirmUnavailable) throw new AccountError('confirm_unavailable', 409); await tx.insert(taskActivities).values({ taskId: row!.id, actorId: actor.user.id, version: 1, fields: ['created'] }); - return this.get(tx, householdId, row!.id, household.timezone); + return created.task(row!.id); }); } - async patch(actor: Actor, householdId: string, id: string, baseVersion: number, changes: TaskChanges, confirmUnavailable = false) { + async patch(actor: Actor, householdId: string, id: string, baseVersion: number, changes: TaskChanges, confirmUnavailable = false, confirmDescendants = false) { return this.db.transaction(async tx => { + // The household row serializes all graph writers, including reparenting and edge edits. + // Validate after tentative writes so the transaction rolls back any effective cycle. const household = await this.scope(tx, actor, householdId, true); const [row] = await tx.select().from(tasks).where(and(eq(tasks.id, id), eq(tasks.householdId, householdId), isNull(tasks.trashedAt))).for('update'); if (!row) throw new AccountError('task_not_found', 404); const current = (await this.hydrate(tx, [row], household.timezone))[0]!; const checked = new Set(Object.keys(changes)); + if (['inherit', 'parentId'].some(key => checked.has(key))) inheritedFields.forEach(key => checked.add(key)); + if (inheritedFields.some(key => checked.has(key))) { checked.add('inherit'); checked.add('parentId'); } + for (const [add, exclude] of [['places', 'placeExclusions'], ['resources', 'resourceExclusions'], ['tags', 'tagExclusions']]) if (checked.has(add!) || checked.has(exclude!)) { checked.add(add!); checked.add(exclude!); checked.add('parentId'); } // Date and optional time form one logical field, even when edited separately. for (const pair of [['startDate', 'startTime'], ['deadlineDate', 'deadlineTime']]) { if (pair.some(key => checked.has(key))) pair.forEach(key => checked.add(key)); @@ -128,19 +189,22 @@ export class TaskService { const conflicts = [...checked].filter(key => (row.fieldVersions[key] ?? 1) > baseVersion); if (baseVersion > row.version || conflicts.length) throw new TaskConflict(current, conflicts.length ? conflicts : Object.keys(changes)); const workflow = moveTaskToColumn(row, changes.column ?? current.column); - const next = taskFields.parse({ ...current, ...changes, column: taskColumn(workflow) }); + const next = taskFields.parse({ ...current.local, ...changes, column: taskColumn(workflow) }); + if (changes.inherit === undefined && current.local.inherit.includes('startDate') && (changes.startDate !== undefined || changes.startTime !== undefined)) { next.startDate = changes.startDate === undefined ? current.startDate : changes.startDate; next.startTime = changes.startTime === undefined ? current.startTime : changes.startTime; } + if (changes.inherit === undefined && current.local.inherit.includes('deadlineDate') && (changes.deadlineDate !== undefined || changes.deadlineTime !== undefined)) { next.deadlineDate = changes.deadlineDate === undefined ? current.deadlineDate : changes.deadlineDate; next.deadlineTime = changes.deadlineTime === undefined ? current.deadlineTime : changes.deadlineTime; } + if (changes.inherit === undefined) next.inherit = next.inherit.filter(key => changes[key] === undefined && !(key === 'startDate' && changes.startTime !== undefined) && !(key === 'deadlineDate' && changes.deadlineTime !== undefined)); if (!next.startDate) next.startTime = null; if (!next.deadlineDate) next.deadlineTime = null; const changed = new Set(Object.keys(changes)); - if (next.startTime !== current.startTime) changed.add('startTime'); - if (next.deadlineTime !== current.deadlineTime) changed.add('deadlineTime'); + if (JSON.stringify(next.inherit) !== JSON.stringify(current.local.inherit)) changed.add('inherit'); + if (next.startTime !== current.local.startTime) changed.add('startTime'); + if (next.deadlineTime !== current.local.deadlineTime) changed.add('deadlineTime'); // An exact duration only suggests an empty size; explicit sizes always survive. if (!next.size && next.estimateMinutes && changes.estimateMinutes !== undefined && changes.size === undefined && (row.fieldVersions.size ?? 1) <= baseVersion) { next.size = suggestSize(next.estimateMinutes, (await this.settings(tx, householdId)).thresholds); changed.add('size'); } await this.validate(tx, householdId, next, current); - if (next.column === 'in_progress' && current.column !== 'in_progress' && !availability(next, household.timezone).available && !confirmUnavailable) throw new AccountError('confirm_unavailable', 409); const version = row.version + 1; const fieldVersions = { ...row.fieldVersions, ...Object.fromEntries([...changed].map(key => [key, version])) }; // Completion metadata changes with the visible column, never with unrelated edits. @@ -150,8 +214,14 @@ export class TaskService { }; await tx.update(tasks).set({ ...this.values(next), ...workflow, ...completion, version, fieldVersions, updatedAt: new Date() }).where(eq(tasks.id, id)); await this.collections(tx, id, next); + await this.graphCollections(tx, id, next, actor.user.id); + const updated = await this.graph(tx, householdId, household.timezone); + updated.graph.validateDependencies(); + const resolved = updated.task(id); + if (next.column === 'in_progress' && current.column !== 'in_progress' && !resolved.available && !confirmUnavailable) throw new AccountError('confirm_unavailable', 409); + if (next.column === 'done' && current.column !== 'done' && resolved.unfinishedDescendants && !confirmDescendants) throw new AccountError('confirm_descendants', 409); await tx.insert(taskActivities).values({ taskId: id, actorId: actor.user.id, version, fields: [...changed] }); - return this.get(tx, householdId, id, household.timezone); + return resolved; }); } async entityList(actor: Actor, householdId: string) { @@ -181,10 +251,11 @@ export class TaskService { if (!entity) throw new AccountError('entity_not_found', 404); if (entity.version !== baseVersion) throw new AccountError('entity_conflict', 409); const linked = await tx.select({ taskId: taskEntities.taskId }).from(taskEntities).where(eq(taskEntities.entityId, id)); - const affected = await tx.select().from(tasks).where(and(eq(tasks.householdId, householdId), entity.kind === 'epic' ? eq(tasks.epicId, id) : inArray(tasks.id, linked.map(l => l.taskId)))); + const excluded = await tx.select({ taskId: taskEntityExclusions.taskId }).from(taskEntityExclusions).where(eq(taskEntityExclusions.entityId, id)); + const affected = await tx.select().from(tasks).where(and(eq(tasks.householdId, householdId), entity.kind === 'epic' ? eq(tasks.epicId, id) : inArray(tasks.id, [...linked, ...excluded].map(l => l.taskId)))); const field = entity.kind === 'epic' ? 'epicId' : ({ place: 'places', resource: 'resources', tag: 'tags' } as const)[entity.kind]; for (const task of affected) { - await tx.update(tasks).set({ version: task.version + 1, fieldVersions: { ...task.fieldVersions, [field]: task.version + 1 }, updatedAt: new Date() }).where(eq(tasks.id, task.id)); + await tx.update(tasks).set({ version: task.version + 1, fieldVersions: { ...task.fieldVersions, [field]: task.version + 1, ...(entity.kind !== 'epic' ? { [entity.kind + 'Exclusions']: task.version + 1 } : {}) }, updatedAt: new Date() }).where(eq(tasks.id, task.id)); await tx.insert(taskActivities).values({ taskId: task.id, actorId: actor.user.id, version: task.version + 1, fields: [field] }); } await tx.delete(entities).where(eq(entities.id, id)); diff --git a/apps/api/src/tasks/tasks.integration.test.ts b/apps/api/src/tasks/tasks.integration.test.ts index 5ef95c1..6f379b7 100644 --- a/apps/api/src/tasks/tasks.integration.test.ts +++ b/apps/api/src/tasks/tasks.integration.test.ts @@ -114,3 +114,87 @@ it('releases a removed member’s assignments without allowing stale editors to await expect(planning.patch(actor, householdA, task.id, task.version, { assignees: [userB] })).rejects.toThrow('task_conflict'); expect((await planning.patch(actor, householdA, task.id, task.version, { title: 'Still editable' })).title).toBe('Still editable'); }); +it('resolves deep item inheritance, explicit none/false, dates and independent Now children', async () => { + const actor = (await service.findSession(sessionA))!; + const car = await planning.entityWrite(actor, householdA, { kind: 'resource', name: 'Car' }); + const ladder = await planning.entityWrite(actor, householdA, { kind: 'resource', name: 'Ladder' }); + const trailer = await planning.entityWrite(actor, householdA, { kind: 'resource', name: 'Trailer' }); + let parent = await planning.create(actor, householdA, { title: 'Parent', resources: [car.id, ladder.id], high: true, startDate: '2099-01-01', startTime: '09:00', deadlineDate: '2099-01-30', assignees: [userA] }); + const child = await planning.create(actor, householdA, { title: 'Child', parentId: parent.id, column: 'todo', resourceExclusions: [car.id], startDate: null, high: false, deadlineDate: '2099-02-05' }); + expect(child).toMatchObject({ resources: [ladder.id], high: false, startDate: null, available: true, deadlineBeyondParent: true, assignees: [userA] }); + let deep = child; + for (let i = 0; i < 12; i++) deep = await planning.create(actor, householdA, { title: `Level ${i}`, parentId: deep.id }); + parent = await planning.patch(actor, householdA, parent.id, parent.version, { resources: [car.id, ladder.id, trailer.id] }); + expect((await planning.get(db, householdA, deep.id, 'Europe/Stockholm')).resources.sort()).toEqual([ladder.id, trailer.id].sort()); + parent = await planning.patch(actor, householdA, parent.id, parent.version, { resources: [car.id, trailer.id] }); + expect((await planning.get(db, householdA, deep.id, 'Europe/Stockholm')).resources).toEqual([trailer.id]); + const now = await planning.list(actor, householdA, 'now', 0, 100); + expect(now.items.some(t => t.id === child.id)).toBe(true); + expect(now.items.some(t => t.id === parent.id)).toBe(false); + const board = await planning.list(actor, householdA, 'board', 0, 100); + expect(board.items.some(t => t.id === child.id)).toBe(false); + expect((await planning.list(actor, householdA, 'board', 0, 100, true)).items.some(t => t.id === child.id)).toBe(true); + const inherited = await planning.patch(actor, householdA, child.id, child.version, { inherit: ['high', 'startDate', 'deadlineDate', 'assignees'] }); + expect(inherited).toMatchObject({ high: true, available: false, deadlineDate: parent.deadlineDate, deadlineBeyondParent: false }); + const none = await planning.patch(actor, householdA, child.id, inherited.version, { deadlineDate: null, assignees: [] }); + expect(none).toMatchObject({ deadlineDate: null, assignees: [] }); + const timed = await planning.patch(actor, householdA, child.id, none.version, { startTime: '10:00' }); + expect(timed).toMatchObject({ startDate: '2099-01-01', startTime: '10:00' }); + expect(timed.local.inherit).not.toContain('startDate'); +}); +it('rejects cross-household graph edges, ancestry cycles and concurrent dependency cycles', async () => { + const actor = (await service.findSession(sessionA))!; + const other = await planning.create((await service.findSession(sessionB))!, householdB, { title: 'Private' }); + const a = await planning.create(actor, householdA, { title: 'Graph A' }); + for (const changes of [{ parentId: other.id }, { blockers: [other.id] }, { related: [other.id] }]) await expect(planning.patch(actor, householdA, a.id, a.version, changes)).rejects.toThrow('invalid_task_reference'); + const b = await planning.create(actor, householdA, { title: 'Graph B' }); + const race = await Promise.allSettled([planning.patch(actor, householdA, a.id, a.version, { blockers: [b.id] }), planning.patch(actor, householdA, b.id, b.version, { blockers: [a.id] })]); + expect(race.filter(result => result.status === 'fulfilled')).toHaveLength(1); + const p = await planning.create(actor, householdA, { title: 'Graph parent' }); + const c = await planning.create(actor, householdA, { title: 'Graph child', parentId: p.id }); + await expect(planning.patch(actor, householdA, p.id, p.version, { parentId: c.id })).rejects.toThrow('task_cycle'); + await expect(planning.patch(actor, householdA, p.id, p.version, { blockers: [c.id] })).rejects.toThrow('dependency_cycle'); + const independent = await planning.create(actor, householdA, { title: 'Independent', blockers: [c.id] }); + await expect(planning.patch(actor, householdA, p.id, p.version, { parentId: independent.id })).rejects.toThrow('dependency_cycle'); + const x = await planning.create(actor, householdA, { title: 'Tree X' }); + const y = await planning.create(actor, householdA, { title: 'Tree Y' }); + const treeRace = await Promise.allSettled([planning.patch(actor, householdA, x.id, x.version, { parentId: y.id }), planning.patch(actor, householdA, y.id, y.version, { parentId: x.id })]); + expect(treeRace.filter(result => result.status === 'fulfilled')).toHaveLength(1); +}); +it('counts direct progress but warns for all descendants; availability checks only effective direct blockers', async () => { + const actor = (await service.findSession(sessionA))!; + const prerequisite = await planning.create(actor, householdA, { title: 'Prerequisite' }); + const permit = await planning.create(actor, householdA, { title: 'Permit', column: 'done', blockers: [prerequisite.id] }); + const parent = await planning.create(actor, householdA, { title: 'Work', blockers: [permit.id] }); + const child = await planning.create(actor, householdA, { title: 'Child done', parentId: parent.id, column: 'done' }); + const grandchild = await planning.create(actor, householdA, { title: 'Work to do', parentId: child.id, column: 'todo' }); + expect(grandchild.available).toBe(true); // Permit is done even though its own blocker isn't. + expect(await planning.get(db, householdA, parent.id, 'UTC')).toMatchObject({ progress: { done: 1, total: 1 }, unfinishedDescendants: 1 }); + await expect(planning.patch(actor, householdA, parent.id, parent.version, { column: 'done' })).rejects.toThrow('confirm_descendants'); + const completed = await planning.patch(actor, householdA, parent.id, parent.version, { column: 'done' }, false, true); + expect(completed.column).toBe('done'); + expect((await planning.get(db, householdA, grandchild.id, 'UTC')).column).toBe('todo'); + let started = await planning.patch(actor, householdA, grandchild.id, grandchild.version, { column: 'in_progress' }); + const reopened = await planning.patch(actor, householdA, permit.id, permit.version, { column: 'todo' }); + expect(reopened.column).toBe('todo'); + expect(await planning.get(db, householdA, started.id, 'UTC')).toMatchObject({ column: 'in_progress', available: false }); + started = await planning.patch(actor, householdA, started.id, started.version, { column: 'todo' }); + await expect(planning.patch(actor, householdA, started.id, started.version, { column: 'in_progress' })).rejects.toThrow('confirm_unavailable'); + expect((await planning.patch(actor, householdA, started.id, started.version, { column: 'in_progress' }, true)).available).toBe(false); +}); +it('keeps relations bidirectional and nonblocking, protects peer edits, and preserves deleted blockers', async () => { + const actor = (await service.findSession(sessionA))!; + const a = await planning.create(actor, householdA, { title: 'Related A', column: 'todo' }); + const b = await planning.create(actor, householdA, { title: 'Related B' }); + const linked = await planning.patch(actor, householdA, a.id, a.version, { related: [b.id] }); + expect(linked.available).toBe(true); + expect((await planning.get(db, householdA, b.id, 'UTC')).related).toEqual([a.id]); + await expect(planning.patch(actor, householdA, b.id, b.version, { related: [] })).rejects.toThrow('task_conflict'); + const blocker = await planning.create(actor, householdA, { title: 'Will be removed', column: 'done' }); + const blocked = await planning.create(actor, householdA, { title: 'Survives deletion', column: 'todo', blockers: [blocker.id] }); + await pool.query('DELETE FROM tasks WHERE id = $1', [blocker.id]); + expect(await planning.get(db, householdA, blocked.id, 'UTC')).toMatchObject({ available: false, effectiveBlockers: [{ id: blocker.id, title: null, complete: false, inherited: false }] }); + const renamed = await planning.patch(actor, householdA, blocked.id, blocked.version, { title: 'Still editable' }); + expect(renamed.available).toBe(false); + expect((await planning.patch(actor, householdA, blocked.id, renamed.version, { blockers: [] })).available).toBe(true); +}); diff --git a/docs/architecture/decisions/0004-effective-task-graph.md b/docs/architecture/decisions/0004-effective-task-graph.md new file mode 100644 index 0000000..d0bec60 --- /dev/null +++ b/docs/architecture/decisions/0004-effective-task-graph.md @@ -0,0 +1,31 @@ +# Effective task graph and write serialization + +Tasks retain local scalar values plus explicit inheritance flags. Existing Stage 3 +rows keep their values, with no inherited flags. Entity additions and exclusions use +separate join tables; deleting an entity removes both and advances affected local +field revisions. Effective values are computed, never copied into descendant rows. + +A single server resolver performs iterative parent-first inheritance and reverse-order +progress aggregation. It handles deep valid trees without recursive JavaScript calls. +Blocking edges are expanded through ancestry for Kahn cycle validation. Availability +only reads completion of those effective blockers, not their transitive dependencies. +Related links use canonical unordered pairs and advance both endpoints' local relation +versions when changed. + +All graph writers acquire the household row lock, recheck membership, validate references, +write tentatively and validate the resulting effective graph within the transaction. +Reparenting first checks descendants with a household-scoped recursive CTE. An invalid +hierarchy or effective cycle rolls back the entire change, including version/activity +updates. Missing blocker IDs intentionally survive target deletion and remain unresolved. + +Reads use a repeatable-read snapshot and batched household joins, without ancestor N+1 +queries or an arbitrary depth/task cap. The resolver currently loads one household's +graph per request; memory grows with household size and inherited sets. This favors +consistency for the current household workload. Stage 5's filter compiler must retain +this authoritative effective-value boundary while improving query selection if needed. +Pagination is applied after effective availability filtering. No derived state is stored +as an independently editable database truth. + +Task responses distinguish effective top-level fields, local edit intent, inherited +parent values, path/progress and blocker metadata. Editors submit local intent and Undo +restores that intent, avoiding accidentally replacing inheritance with copied values. diff --git a/packages/shared/openapi.json b/packages/shared/openapi.json index 03a954c..9aee304 100644 --- a/packages/shared/openapi.json +++ b/packages/shared/openapi.json @@ -5433,6 +5433,39 @@ "name": "offset", "required": false }, + { + "schema": { + "default": "", + "type": "string", + "maxLength": 200 + }, + "in": "query", + "name": "search", + "required": false + }, + { + "schema": { + "default": "false", + "type": "string", + "enum": [ + "true", + "false" + ] + }, + "in": "query", + "name": "includeSubtasks", + "required": false + }, + { + "schema": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "in": "query", + "name": "parentId", + "required": false + }, { "schema": { "default": 100, @@ -5468,6 +5501,70 @@ "items": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -5537,7 +5634,6 @@ "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" }, "assignees": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -5546,7 +5642,6 @@ } }, "places": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -5555,7 +5650,6 @@ } }, "resources": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -5564,7 +5658,6 @@ } }, "tags": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -5572,6 +5665,442 @@ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, + "local": { + "type": "object", + "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + }, + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "size": { + "nullable": true, + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "estimateMinutes": { + "nullable": true, + "type": "integer", + "minimum": 1, + "maximum": 525600 + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", + "title", + "description", + "column", + "epicId", + "high", + "size", + "estimateMinutes", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "inheritedValues": { + "type": "object", + "properties": { + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "epicId", + "high", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "ancestors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "relatedTasks": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "children": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "effectiveBlockers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "nullable": true, + "type": "string" + }, + "complete": { + "type": "boolean" + }, + "inherited": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "complete", + "inherited" + ], + "additionalProperties": false + } + }, + "progress": { + "type": "object", + "properties": { + "done": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": false + }, + "unfinishedDescendants": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deadlineBeyondParent": { + "type": "boolean" + }, "id": { "type": "string", "format": "uuid", @@ -5614,6 +6143,13 @@ } }, "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", "title", "description", "column", @@ -5629,6 +6165,15 @@ "places", "resources", "tags", + "local", + "inheritedValues", + "ancestors", + "relatedTasks", + "children", + "effectiveBlockers", + "progress", + "unfinishedDescendants", + "deadlineBeyondParent", "id", "householdId", "version", @@ -5819,6 +6364,70 @@ "schema": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -5925,6 +6534,9 @@ }, "confirmUnavailable": { "type": "boolean" + }, + "confirmDescendants": { + "type": "boolean" } }, "required": [ @@ -5955,20 +6567,84 @@ "schema": { "type": "object", "properties": { - "title": { - "type": "string", - "minLength": 1, - "maxLength": 300 - }, - "description": { + "parentId": { + "nullable": true, "type": "string", - "maxLength": 50000 + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, - "column": { - "type": "string", - "enum": [ - "someday", - "within_year", + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", "within_month", "todo", "in_progress", @@ -6024,7 +6700,6 @@ "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" }, "assignees": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -6032,32 +6707,465 @@ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, - "places": { - "maxItems": 100, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "local": { + "type": "object", + "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + }, + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "size": { + "nullable": true, + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "estimateMinutes": { + "nullable": true, + "type": "integer", + "minimum": 1, + "maximum": 525600 + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", + "title", + "description", + "column", + "epicId", + "high", + "size", + "estimateMinutes", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "inheritedValues": { + "type": "object", + "properties": { + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "epicId", + "high", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "ancestors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "relatedTasks": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "children": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "resources": { - "maxItems": 100, + "effectiveBlockers": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "nullable": true, + "type": "string" + }, + "complete": { + "type": "boolean" + }, + "inherited": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "complete", + "inherited" + ], + "additionalProperties": false } }, - "tags": { - "maxItems": 100, - "type": "array", - "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" - } + "progress": { + "type": "object", + "properties": { + "done": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": false + }, + "unfinishedDescendants": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deadlineBeyondParent": { + "type": "boolean" }, "id": { "type": "string", @@ -6101,6 +7209,13 @@ } }, "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", "title", "description", "column", @@ -6116,6 +7231,15 @@ "places", "resources", "tags", + "local", + "inheritedValues", + "ancestors", + "relatedTasks", + "children", + "effectiveBlockers", + "progress", + "unfinishedDescendants", + "deadlineBeyondParent", "id", "householdId", "version", @@ -6319,6 +7443,70 @@ "schema": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -6382,47 +7570,479 @@ "format": "date", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" }, - "deadlineTime": { - "nullable": true, - "type": "string", - "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "local": { + "type": "object", + "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + }, + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "size": { + "nullable": true, + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "estimateMinutes": { + "nullable": true, + "type": "integer", + "minimum": 1, + "maximum": 525600 + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", + "title", + "description", + "column", + "epicId", + "high", + "size", + "estimateMinutes", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "inheritedValues": { + "type": "object", + "properties": { + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "epicId", + "high", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false }, - "assignees": { - "maxItems": 100, + "ancestors": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "places": { - "maxItems": 100, + "relatedTasks": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "resources": { - "maxItems": 100, + "children": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "tags": { - "maxItems": 100, + "effectiveBlockers": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "nullable": true, + "type": "string" + }, + "complete": { + "type": "boolean" + }, + "inherited": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "complete", + "inherited" + ], + "additionalProperties": false } }, + "progress": { + "type": "object", + "properties": { + "done": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": false + }, + "unfinishedDescendants": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deadlineBeyondParent": { + "type": "boolean" + }, "id": { "type": "string", "format": "uuid", @@ -6465,6 +8085,13 @@ } }, "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", "title", "description", "column", @@ -6480,6 +8107,15 @@ "places", "resources", "tags", + "local", + "inheritedValues", + "ancestors", + "relatedTasks", + "children", + "effectiveBlockers", + "progress", + "unfinishedDescendants", + "deadlineBeyondParent", "id", "householdId", "version", @@ -6666,6 +8302,70 @@ "changes": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -6785,6 +8485,9 @@ }, "confirmUnavailable": { "type": "boolean" + }, + "confirmDescendants": { + "type": "boolean" } }, "required": [ @@ -6825,6 +8528,70 @@ "schema": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -6893,42 +8660,474 @@ "type": "string", "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" }, - "assignees": { - "maxItems": 100, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "local": { + "type": "object", + "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + }, + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "size": { + "nullable": true, + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "estimateMinutes": { + "nullable": true, + "type": "integer", + "minimum": 1, + "maximum": 525600 + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", + "title", + "description", + "column", + "epicId", + "high", + "size", + "estimateMinutes", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "inheritedValues": { + "type": "object", + "properties": { + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "epicId", + "high", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "ancestors": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "places": { - "maxItems": 100, + "relatedTasks": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "resources": { - "maxItems": 100, + "children": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false } }, - "tags": { - "maxItems": 100, + "effectiveBlockers": { "type": "array", "items": { - "type": "string", - "format": "uuid", - "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "nullable": true, + "type": "string" + }, + "complete": { + "type": "boolean" + }, + "inherited": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "complete", + "inherited" + ], + "additionalProperties": false } }, + "progress": { + "type": "object", + "properties": { + "done": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": false + }, + "unfinishedDescendants": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deadlineBeyondParent": { + "type": "boolean" + }, "id": { "type": "string", "format": "uuid", @@ -6971,6 +9170,13 @@ } }, "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", "title", "description", "column", @@ -6986,6 +9192,15 @@ "places", "resources", "tags", + "local", + "inheritedValues", + "ancestors", + "relatedTasks", + "children", + "effectiveBlockers", + "progress", + "unfinishedDescendants", + "deadlineBeyondParent", "id", "householdId", "version", @@ -7102,6 +9317,70 @@ "current": { "type": "object", "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, "title": { "type": "string", "minLength": 1, @@ -7171,7 +9450,6 @@ "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" }, "assignees": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -7180,7 +9458,6 @@ } }, "places": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -7189,7 +9466,6 @@ } }, "resources": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -7198,7 +9474,6 @@ } }, "tags": { - "maxItems": 100, "type": "array", "items": { "type": "string", @@ -7206,6 +9481,442 @@ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" } }, + "local": { + "type": "object", + "properties": { + "parentId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "inherit": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "epicId", + "high", + "startDate", + "deadlineDate", + "assignees" + ] + } + }, + "placeExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resourceExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tagExclusions": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "blockers": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "related": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 300 + }, + "description": { + "type": "string", + "maxLength": 50000 + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + }, + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "size": { + "nullable": true, + "type": "string", + "enum": [ + "XS", + "S", + "M", + "L", + "XL" + ] + }, + "estimateMinutes": { + "nullable": true, + "type": "integer", + "minimum": 1, + "maximum": 525600 + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "maxItems": 100, + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", + "title", + "description", + "column", + "epicId", + "high", + "size", + "estimateMinutes", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "inheritedValues": { + "type": "object", + "properties": { + "epicId": { + "nullable": true, + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "high": { + "type": "boolean" + }, + "startDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "startTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "deadlineDate": { + "nullable": true, + "type": "string", + "format": "date", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$" + }, + "deadlineTime": { + "nullable": true, + "type": "string", + "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$" + }, + "assignees": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "places": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + } + }, + "required": [ + "epicId", + "high", + "startDate", + "startTime", + "deadlineDate", + "deadlineTime", + "assignees", + "places", + "resources", + "tags" + ], + "additionalProperties": false + }, + "ancestors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "relatedTasks": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "children": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "type": "string" + }, + "column": { + "type": "string", + "enum": [ + "someday", + "within_year", + "within_month", + "todo", + "in_progress", + "done" + ] + } + }, + "required": [ + "id", + "title", + "column" + ], + "additionalProperties": false + } + }, + "effectiveBlockers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "title": { + "nullable": true, + "type": "string" + }, + "complete": { + "type": "boolean" + }, + "inherited": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "complete", + "inherited" + ], + "additionalProperties": false + } + }, + "progress": { + "type": "object", + "properties": { + "done": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "done", + "total" + ], + "additionalProperties": false + }, + "unfinishedDescendants": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deadlineBeyondParent": { + "type": "boolean" + }, "id": { "type": "string", "format": "uuid", @@ -7248,6 +9959,13 @@ } }, "required": [ + "parentId", + "inherit", + "placeExclusions", + "resourceExclusions", + "tagExclusions", + "blockers", + "related", "title", "description", "column", @@ -7263,6 +9981,15 @@ "places", "resources", "tags", + "local", + "inheritedValues", + "ancestors", + "relatedTasks", + "children", + "effectiveBlockers", + "progress", + "unfinishedDescendants", + "deadlineBeyondParent", "id", "householdId", "version", diff --git a/packages/shared/src/generated/api.ts b/packages/shared/src/generated/api.ts index 0639015..0245d23 100644 --- a/packages/shared/src/generated/api.ts +++ b/packages/shared/src/generated/api.ts @@ -3390,6 +3390,9 @@ export interface paths { query?: { view?: "now" | "board"; offset?: number; + search?: string; + includeSubtasks?: "true" | "false"; + parentId?: string; limit?: number; }; header?: never; @@ -3408,6 +3411,14 @@ export interface paths { content: { "application/json": { items: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; title: string; description: string; /** @enum {string} */ @@ -3428,6 +3439,85 @@ export interface paths { places: string[]; resources: string[]; tags: string[]; + local: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; + title: string; + description: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** @enum {string|null} */ + size: "XS" | "S" | "M" | "L" | "XL" | null; + estimateMinutes: number | null; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + inheritedValues: { + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + ancestors: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + relatedTasks: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + children: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + effectiveBlockers: { + /** Format: uuid */ + id: string; + title: string | null; + complete: boolean; + inherited: boolean; + }[]; + progress: { + done: number; + total: number; + }; + unfinishedDescendants: number; + deadlineBeyondParent: boolean; /** Format: uuid */ id: string; /** Format: uuid */ @@ -3549,6 +3639,14 @@ export interface paths { requestBody: { content: { "application/json": { + /** Format: uuid */ + parentId?: string | null; + inherit?: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions?: string[]; + resourceExclusions?: string[]; + tagExclusions?: string[]; + blockers?: string[]; + related?: string[]; title: string; description?: string; /** @enum {string} */ @@ -3570,6 +3668,7 @@ export interface paths { resources?: string[]; tags?: string[]; confirmUnavailable?: boolean; + confirmDescendants?: boolean; }; }; }; @@ -3581,6 +3680,14 @@ export interface paths { }; content: { "application/json": { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; title: string; description: string; /** @enum {string} */ @@ -3601,6 +3708,85 @@ export interface paths { places: string[]; resources: string[]; tags: string[]; + local: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; + title: string; + description: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** @enum {string|null} */ + size: "XS" | "S" | "M" | "L" | "XL" | null; + estimateMinutes: number | null; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + inheritedValues: { + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + ancestors: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + relatedTasks: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + children: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + effectiveBlockers: { + /** Format: uuid */ + id: string; + title: string | null; + complete: boolean; + inherited: boolean; + }[]; + progress: { + done: number; + total: number; + }; + unfinishedDescendants: number; + deadlineBeyondParent: boolean; /** Format: uuid */ id: string; /** Format: uuid */ @@ -3739,6 +3925,14 @@ export interface paths { }; content: { "application/json": { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; title: string; description: string; /** @enum {string} */ @@ -3759,6 +3953,85 @@ export interface paths { places: string[]; resources: string[]; tags: string[]; + local: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; + title: string; + description: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** @enum {string|null} */ + size: "XS" | "S" | "M" | "L" | "XL" | null; + estimateMinutes: number | null; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + inheritedValues: { + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + ancestors: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + relatedTasks: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + children: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + effectiveBlockers: { + /** Format: uuid */ + id: string; + title: string | null; + complete: boolean; + inherited: boolean; + }[]; + progress: { + done: number; + total: number; + }; + unfinishedDescendants: number; + deadlineBeyondParent: boolean; /** Format: uuid */ id: string; /** Format: uuid */ @@ -3885,6 +4158,14 @@ export interface paths { "application/json": { baseVersion: number; changes: { + /** Format: uuid */ + parentId?: string | null; + inherit?: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions?: string[]; + resourceExclusions?: string[]; + tagExclusions?: string[]; + blockers?: string[]; + related?: string[]; title?: string; description?: string; column?: ("someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done") | "reopen"; @@ -3906,6 +4187,7 @@ export interface paths { tags?: string[]; }; confirmUnavailable?: boolean; + confirmDescendants?: boolean; }; }; }; @@ -3917,6 +4199,14 @@ export interface paths { }; content: { "application/json": { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; title: string; description: string; /** @enum {string} */ @@ -3937,6 +4227,85 @@ export interface paths { places: string[]; resources: string[]; tags: string[]; + local: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; + title: string; + description: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** @enum {string|null} */ + size: "XS" | "S" | "M" | "L" | "XL" | null; + estimateMinutes: number | null; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + inheritedValues: { + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + ancestors: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + relatedTasks: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + children: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + effectiveBlockers: { + /** Format: uuid */ + id: string; + title: string | null; + complete: boolean; + inherited: boolean; + }[]; + progress: { + done: number; + total: number; + }; + unfinishedDescendants: number; + deadlineBeyondParent: boolean; /** Format: uuid */ id: string; /** Format: uuid */ @@ -4008,6 +4377,14 @@ export interface paths { error: "task_conflict"; fields: string[]; current: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; title: string; description: string; /** @enum {string} */ @@ -4028,6 +4405,85 @@ export interface paths { places: string[]; resources: string[]; tags: string[]; + local: { + /** Format: uuid */ + parentId: string | null; + inherit: ("epicId" | "high" | "startDate" | "deadlineDate" | "assignees")[]; + placeExclusions: string[]; + resourceExclusions: string[]; + tagExclusions: string[]; + blockers: string[]; + related: string[]; + title: string; + description: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** @enum {string|null} */ + size: "XS" | "S" | "M" | "L" | "XL" | null; + estimateMinutes: number | null; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + inheritedValues: { + /** Format: uuid */ + epicId: string | null; + high: boolean; + /** Format: date */ + startDate: string | null; + startTime: string | null; + /** Format: date */ + deadlineDate: string | null; + deadlineTime: string | null; + assignees: string[]; + places: string[]; + resources: string[]; + tags: string[]; + }; + ancestors: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + relatedTasks: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + children: { + /** Format: uuid */ + id: string; + title: string; + /** @enum {string} */ + column: "someday" | "within_year" | "within_month" | "todo" | "in_progress" | "done"; + }[]; + effectiveBlockers: { + /** Format: uuid */ + id: string; + title: string | null; + complete: boolean; + inherited: boolean; + }[]; + progress: { + done: number; + total: number; + }; + unfinishedDescendants: number; + deadlineBeyondParent: boolean; /** Format: uuid */ id: string; /** Format: uuid */ diff --git a/packages/shared/src/tasks.ts b/packages/shared/src/tasks.ts index 76132e8..81732fb 100644 --- a/packages/shared/src/tasks.ts +++ b/packages/shared/src/tasks.ts @@ -15,7 +15,11 @@ import { iconNames } from './icons.js'; export { iconNames } from './icons.js'; export const iconSchema = z.enum(iconNames); const ids = z.array(z.uuid()).max(100); +export const inheritedFields = ['epicId', 'high', 'startDate', 'deadlineDate', 'assignees'] as const; +export const inheritanceSchema = z.array(z.enum(inheritedFields)); export const taskFields = z.object({ + parentId: z.uuid().nullable(), inherit: inheritanceSchema, + placeExclusions: ids, resourceExclusions: ids, tagExclusions: ids, blockers: ids, related: ids, title: z.string().trim().min(1).max(300), description: z.string().max(50_000), column: columnSchema, epicId: z.uuid().nullable(), high: z.boolean(), size: z.enum(sizes).nullable(), estimateMinutes: z.number().int().min(1).max(525600).nullable(), @@ -23,10 +27,19 @@ export const taskFields = z.object({ deadlineDate: z.iso.date().nullable(), deadlineTime: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/).nullable(), assignees: ids, places: ids, resources: ids, tags: ids, }); -export const taskCreateSchema = taskFields.partial().extend({ title: taskFields.shape.title, confirmUnavailable: z.boolean().optional() }).strict(); +export const taskCreateSchema = taskFields.partial().extend({ title: taskFields.shape.title, confirmUnavailable: z.boolean().optional(), confirmDescendants: z.boolean().optional() }).strict(); export const taskChangesSchema = taskFields.partial().extend({ column: z.union([columnSchema, z.literal('reopen')]).optional() }).strict().refine(v => Object.keys(v).length > 0); -export const taskPatchSchema = z.object({ baseVersion: z.number().int().min(1), changes: taskChangesSchema, confirmUnavailable: z.boolean().optional() }); +export const taskPatchSchema = z.object({ baseVersion: z.number().int().min(1), changes: taskChangesSchema, confirmUnavailable: z.boolean().optional(), confirmDescendants: z.boolean().optional() }); +export const inheritedValuesSchema = taskFields.pick({ epicId: true, high: true, startDate: true, startTime: true, deadlineDate: true, deadlineTime: true, assignees: true, places: true, resources: true, tags: true }).extend({ assignees: z.array(z.uuid()), places: z.array(z.uuid()), resources: z.array(z.uuid()), tags: z.array(z.uuid()) }); +export const taskLinkSchema = z.object({ id: z.uuid(), title: z.string(), column: columnSchema }); export const taskSchema = taskFields.extend({ + local: taskFields, inheritedValues: inheritedValuesSchema, + places: z.array(z.uuid()), resources: z.array(z.uuid()), tags: z.array(z.uuid()), assignees: z.array(z.uuid()), + ancestors: z.array(taskLinkSchema), relatedTasks: z.array(taskLinkSchema), children: z.array(taskLinkSchema), + effectiveBlockers: z.array(z.object({ id: z.uuid(), title: z.string().nullable(), complete: z.boolean(), inherited: z.boolean() })), + progress: z.object({ done: z.number().int(), total: z.number().int() }), + unfinishedDescendants: z.number().int(), deadlineBeyondParent: z.boolean(), + id: z.uuid(), householdId: z.uuid(), version: z.number().int(), order: z.number(), available: z.boolean(), overdue: z.boolean(), createdAt: z.string(), updatedAt: z.string(), completedAt: z.string().nullable(), completedBy: z.uuid().nullable(), From dcbca3305e778cb803f80806f18e744a655ad1f7 Mon Sep 17 00:00:00 2001 From: Stephan Terning Date: Wed, 14 Oct 2026 20:17:31 +0200 Subject: [PATCH 02/27] feat(web): add subtask planning and inherited property controls --- apps/web/src/style.css | 12 +++++++ apps/web/src/tasks/TaskEditor.tsx | 26 ++++++++------ apps/web/src/tasks/TaskFields.tsx | 51 +++++++++++++++++++++----- apps/web/src/tasks/TaskStructure.tsx | 54 ++++++++++++++++++++++++++++ apps/web/src/tasks/Workspace.tsx | 29 +++++++++------ apps/web/src/tasks/api.ts | 4 +-- apps/web/src/tasks/i18n.ts | 16 ++++++++- tests/accounts.spec.ts | 2 ++ tests/hierarchy-journey.ts | 48 +++++++++++++++++++++++++ 9 files changed, 210 insertions(+), 32 deletions(-) create mode 100644 apps/web/src/tasks/TaskStructure.tsx create mode 100644 tests/hierarchy-journey.ts diff --git a/apps/web/src/style.css b/apps/web/src/style.css index 4349ca7..c2a81b1 100644 --- a/apps/web/src/style.css +++ b/apps/web/src/style.css @@ -210,3 +210,15 @@ p { margin: .65rem 0; } .place-location { border-block: 1px solid var(--border); padding-block: 1rem; margin-block: 1rem; } .place-location input[type="range"] { width: 100%; padding: 0; accent-color: #087fff; } .icon-picker { max-height: 240px; overflow-y: auto; padding: 3px; } + +.inherit-control { display: block; font-size: .8rem; color: var(--muted); margin: .2rem 0 .7rem; } +.task-ancestors { display: flex; flex-wrap: wrap; gap: .25rem; font-size: .85rem; } +.task-links, .task-picker-results { list-style: none; padding: 0; margin: .5rem 0; } +.task-links li { display: flex; align-items: center; gap: .4rem; } +.task-links li > .quiet { flex: 1; text-align: left; overflow-wrap: anywhere; } +.task-links small, .task-picker-results small { display: block; font-size: .75rem; color: var(--muted); } +.task-picker-results { max-height: 220px; overflow-y: auto; } +.task-picker-results button { width: 100%; text-align: left; margin-bottom: .25rem; } +.subtask-capture { display: flex; flex-wrap: wrap; gap: .5rem; } +.subtask-capture input { flex: 1; min-width: 150px; } +.task-structure { margin-top: 1rem; } diff --git a/apps/web/src/tasks/TaskEditor.tsx b/apps/web/src/tasks/TaskEditor.tsx index 035f98c..578819f 100644 --- a/apps/web/src/tasks/TaskEditor.tsx +++ b/apps/web/src/tasks/TaskEditor.tsx @@ -3,19 +3,21 @@ import { useTranslation } from 'react-i18next'; import { taskFields, type Task, type TaskChanges, type Entity } from '@tendly/shared'; import { Dialog } from '../components/ui/dialog.js'; import { TaskFields, type Member } from './TaskFields.js'; +import { TaskStructure } from './TaskStructure.js'; import { EditFailure } from './api.js'; -export function TaskEditor({ task, entities, members, timezone, onSave, onRefresh, onClose }: { +export function TaskEditor({ task, entities, members, timezone, onSave, onRefresh, onClose, householdId, onOpen, onCreated, onToggle }: { + householdId: string; onOpen: (id: string) => void; onCreated: (task: Task) => void; onToggle: (id: string) => Promise; task: Task; entities: Entity[]; members: Member[]; timezone: string; onRefresh: (task: Task) => void; - onSave: (base: Task, changes: TaskChanges, confirm?: boolean) => Promise; onClose: () => void; + onSave: (base: Task, changes: TaskChanges, confirm?: boolean, confirmDescendants?: boolean) => Promise; onClose: () => void; }) { const { t } = useTranslation(); const [base, setBase] = useState(task); - const [draft, setDraft] = useState(taskFields.parse(task)); + const [draft, setDraft] = useState(taskFields.parse(task.local)); const [failure, setFailure] = useState(null); const [pending, setPending] = useState(false); const saving = useRef(false); - const changes: TaskChanges = Object.fromEntries(Object.entries(draft).filter(([key, value]) => JSON.stringify(value) !== JSON.stringify(base[key as keyof Task]))); + const changes: TaskChanges = Object.fromEntries(Object.entries(draft).filter(([key, value]) => JSON.stringify(value) !== JSON.stringify(base.local[key as keyof typeof base.local]))); const signature = JSON.stringify(changes); async function save(from = base, confirmed = false): Promise { if (saving.current) return false; @@ -23,16 +25,16 @@ export function TaskEditor({ task, entities, members, timezone, onSave, onRefres if (!draft.title.trim()) { setFailure(new EditFailure('invalid_input')); return false; } saving.current = true; setPending(true); setFailure(null); try { - const next = await onSave(from, changes, confirmed); - setBase(next); setDraft(taskFields.parse(next)); return true; + const next = await onSave(from, changes, confirmed && failure?.message === 'confirm_unavailable', confirmed && failure?.message === 'confirm_descendants'); + setBase(next); setDraft(taskFields.parse(next.local)); return true; } catch (error) { setFailure(error instanceof EditFailure ? error : new EditFailure('network_error')); return false; } finally { saving.current = false; setPending(false); } } useEffect(() => { // Conflict resolution may be newer than the query cache. Never move backwards. - if (signature === '{}' && !pending && task.version > base.version) { - setBase(task); setDraft(taskFields.parse(task)); + if (signature === '{}' && !pending && (task.version > base.version || task.version === base.version && JSON.stringify(task) !== JSON.stringify(base))) { + setBase(task); setDraft(taskFields.parse(task.local)); } }, [task, signature, pending, base.version]); useEffect(() => { @@ -51,13 +53,15 @@ export function TaskEditor({ task, entities, members, timezone, onSave, onRefres

{pending ? t('saving') : failure ? t('taskSaveFailed') : signature === '{}' ? t('taskSaved') : t('saving')}

{failure &&

{t(failure.message === 'task_conflict' ? 'conflictText' : failure.message)}

- {failure.current ?
- : } + {failure.current ?
+ : }
}