Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(columns): add column management

Andrej189236cd1976
diff --git a/apps/api/drizzle/0012_mixed_thor_girl.sql b/apps/api/drizzle/0012_mixed_thor_girl.sql
new file mode 100644
index 000000000..29ced03e5
--- /dev/null
+++ b/apps/api/drizzle/0012_mixed_thor_girl.sql
@@ -0,0 +1,30 @@
+CREATE TABLE "column" (
+ "id" text PRIMARY KEY NOT NULL,
+ "project_id" text NOT NULL,
+ "name" text NOT NULL,
+ "slug" text NOT NULL,
+ "position" integer DEFAULT 0 NOT NULL,
+ "icon" text,
+ "color" text,
+ "is_final" boolean DEFAULT false NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "workflow_rule" (
+ "id" text PRIMARY KEY NOT NULL,
+ "project_id" text NOT NULL,
+ "integration_type" text NOT NULL,
+ "event_type" text NOT NULL,
+ "column_id" text NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "task" ADD COLUMN "column_id" text;--> statement-breakpoint
+ALTER TABLE "column" ADD CONSTRAINT "column_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "workflow_rule" ADD CONSTRAINT "workflow_rule_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "workflow_rule" ADD CONSTRAINT "workflow_rule_column_id_column_id_fk" FOREIGN KEY ("column_id") REFERENCES "public"."column"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+CREATE INDEX "column_projectId_idx" ON "column" USING btree ("project_id");--> statement-breakpoint
+CREATE INDEX "workflow_rule_projectId_idx" ON "workflow_rule" USING btree ("project_id");--> statement-breakpoint
+ALTER TABLE "task" ADD CONSTRAINT "task_column_id_column_id_fk" FOREIGN KEY ("column_id") REFERENCES "public"."column"("id") ON DELETE set null ON UPDATE cascade;
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0012_snapshot.json b/apps/api/drizzle/meta/0012_snapshot.json
new file mode 100644
index 000000000..1b4a4ad72
--- /dev/null
+++ b/apps/api/drizzle/meta/0012_snapshot.json
@@ -0,0 +1,2040 @@
+{
+ "id": "a8fd55db-33b9-40a0-892e-a11e36505fc0",
+ "prevId": "95fa9105-bddc-4049-b23d-2c413b803c23",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_name": {
+ "name": "external_user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_avatar": {
+ "name": "external_user_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_source": {
+ "name": "external_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_url": {
+ "name": "external_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 86400000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 10
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_userId_idx": {
+ "name": "apikey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "apikey_user_id_user_id_fk": {
+ "name": "apikey_user_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.column": {
+ "name": "column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_final": {
+ "name": "is_final",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "column_projectId_idx": {
+ "name": "column_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "column_project_id_project_id_fk": {
+ "name": "column_project_id_project_id_fk",
+ "tableFrom": "column",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_link": {
+ "name": "external_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "external_link_taskId_idx": {
+ "name": "external_link_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_integrationId_idx": {
+ "name": "external_link_integrationId_idx",
+ "columns": [
+ {
+ "expression": "integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_externalId_idx": {
+ "name": "external_link_externalId_idx",
+ "columns": [
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_resourceType_idx": {
+ "name": "external_link_resourceType_idx",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "external_link_task_id_task_id_fk": {
+ "name": "external_link_task_id_task_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "external_link_integration_id_integration_id_fk": {
+ "name": "external_link_integration_id_integration_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_integration": {
+ "name": "github_integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_owner": {
+ "name": "repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_integration_project_id_project_id_fk": {
+ "name": "github_integration_project_id_project_id_fk",
+ "tableFrom": "github_integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_integration_project_id_unique": {
+ "name": "github_integration_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration": {
+ "name": "integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_projectId_idx": {
+ "name": "integration_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_type_idx": {
+ "name": "integration_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_project_id_project_id_fk": {
+ "name": "integration_project_id_project_id_fk",
+ "tableFrom": "integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_workspaceId_idx": {
+ "name": "invitation_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_workspace_id_workspace_id_fk": {
+ "name": "project_workspace_id_workspace_id_fk",
+ "tableFrom": "project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_column_id_column_id_fk": {
+ "name": "task_column_id_column_id_fk",
+ "tableFrom": "task",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "teamMember_teamId_idx": {
+ "name": "teamMember_teamId_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teamMember_userId_idx": {
+ "name": "teamMember_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_workspaceId_idx": {
+ "name": "team_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_anonymous": {
+ "name": "is_anonymous",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_rule": {
+ "name": "workflow_rule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_type": {
+ "name": "integration_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_rule_projectId_idx": {
+ "name": "workflow_rule_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_rule_project_id_project_id_fk": {
+ "name": "workflow_rule_project_id_project_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "workflow_rule_column_id_column_id_fk": {
+ "name": "workflow_rule_column_id_column_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_member_workspaceId_idx": {
+ "name": "workspace_member_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_member_userId_idx": {
+ "name": "workspace_member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_member_user_id_user_id_fk": {
+ "name": "workspace_member_user_id_user_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index 62872bb16..c5ed6a886 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -85,6 +85,13 @@
"when": 1767037714394,
"tag": "0011_flashy_masked_marvel",
"breakpoints": true
+ },
+ {
+ "idx": 12,
+ "version": "7",
+ "when": 1770375054098,
+ "tag": "0012_mixed_thor_girl",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/column/controllers/create-column.ts b/apps/api/src/column/controllers/create-column.ts
new file mode 100644
index 000000000..862e9328e
--- /dev/null
+++ b/apps/api/src/column/controllers/create-column.ts
@@ -0,0 +1,71 @@
+import { eq, sql } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { columnTable } from "../../database/schema";
+
+function toSlug(name: string): string {
+ return name
+ .toLowerCase()
+ .trim()
+ .replace(/[^a-z0-9]+/g, "-")
+ .replace(/^-+|-+$/g, "");
+}
+
+async function createColumn({
+ projectId,
+ name,
+ icon,
+ color,
+ isFinal,
+}: {
+ projectId: string;
+ name: string;
+ icon?: string;
+ color?: string;
+ isFinal?: boolean;
+}) {
+ const slug = toSlug(name);
+
+ const existing = await db
+ .select({ id: columnTable.id })
+ .from(columnTable)
+ .where(
+ sql`${columnTable.projectId} = ${projectId} AND ${columnTable.slug} = ${slug}`,
+ );
+
+ if (existing.length > 0) {
+ throw new HTTPException(409, {
+ message: `Column with slug "${slug}" already exists in this project`,
+ });
+ }
+
+ const [maxPos] = await db
+ .select({
+ maxPosition: sql<number>`COALESCE(MAX(${columnTable.position}), -1)`,
+ })
+ .from(columnTable)
+ .where(eq(columnTable.projectId, projectId));
+
+ const position = (maxPos?.maxPosition ?? -1) + 1;
+
+ const [created] = await db
+ .insert(columnTable)
+ .values({
+ projectId,
+ name,
+ slug,
+ position,
+ icon: icon || null,
+ color: color || null,
+ isFinal: isFinal ?? false,
+ })
+ .returning();
+
+ if (!created) {
+ throw new HTTPException(500, { message: "Failed to create column" });
+ }
+
+ return created;
+}
+
+export default createColumn;
diff --git a/apps/api/src/column/controllers/delete-column.ts b/apps/api/src/column/controllers/delete-column.ts
new file mode 100644
index 000000000..a14fd0c38
--- /dev/null
+++ b/apps/api/src/column/controllers/delete-column.ts
@@ -0,0 +1,32 @@
+import { eq, sql } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { columnTable, taskTable } from "../../database/schema";
+
+async function deleteColumn(id: string) {
+ const existing = await db.query.columnTable.findFirst({
+ where: eq(columnTable.id, id),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, { message: "Column not found" });
+ }
+
+ const [taskCount] = await db
+ .select({ count: sql<number>`count(*)` })
+ .from(taskTable)
+ .where(eq(taskTable.columnId, id));
+
+ if (taskCount && taskCount.count > 0) {
+ throw new HTTPException(409, {
+ message:
+ "Cannot delete column that contains tasks. Move or delete tasks first.",
+ });
+ }
+
+ await db.delete(columnTable).where(eq(columnTable.id, id));
+
+ return existing;
+}
+
+export default deleteColumn;
diff --git a/apps/api/src/column/controllers/get-columns.ts b/apps/api/src/column/controllers/get-columns.ts
new file mode 100644
index 000000000..380dc027d
--- /dev/null
+++ b/apps/api/src/column/controllers/get-columns.ts
@@ -0,0 +1,15 @@
+import { asc, eq } from "drizzle-orm";
+import db from "../../database";
+import { columnTable } from "../../database/schema";
+
+async function getColumns(projectId: string) {
+ const columns = await db
+ .select()
+ .from(columnTable)
+ .where(eq(columnTable.projectId, projectId))
+ .orderBy(asc(columnTable.position));
+
+ return columns;
+}
+
+export default getColumns;
diff --git a/apps/api/src/column/controllers/reorder-columns.ts b/apps/api/src/column/controllers/reorder-columns.ts
new file mode 100644
index 000000000..c8f10281e
--- /dev/null
+++ b/apps/api/src/column/controllers/reorder-columns.ts
@@ -0,0 +1,34 @@
+import { and, eq } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { columnTable } from "../../database/schema";
+
+async function reorderColumns(
+ projectId: string,
+ columns: Array<{ id: string; position: number }>,
+) {
+ for (const col of columns) {
+ const [updated] = await db
+ .update(columnTable)
+ .set({ position: col.position })
+ .where(
+ and(eq(columnTable.id, col.id), eq(columnTable.projectId, projectId)),
+ )
+ .returning({ id: columnTable.id });
+
+ if (!updated) {
+ throw new HTTPException(400, {
+ message: `Column ${col.id} does not belong to this project`,
+ });
+ }
+ }
+
+ const updated = await db.query.columnTable.findMany({
+ where: eq(columnTable.projectId, projectId),
+ orderBy: (columns, { asc }) => [asc(columns.position)],
+ });
+
+ return updated;
+}
+
+export default reorderColumns;
diff --git a/apps/api/src/column/controllers/update-column.ts b/apps/api/src/column/controllers/update-column.ts
new file mode 100644
index 000000000..420203a4b
--- /dev/null
+++ b/apps/api/src/column/controllers/update-column.ts
@@ -0,0 +1,41 @@
+import { eq } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { columnTable } from "../../database/schema";
+
+async function updateColumn(
+ id: string,
+ data: {
+ name?: string;
+ icon?: string | null;
+ color?: string | null;
+ isFinal?: boolean;
+ },
+) {
+ const existing = await db.query.columnTable.findFirst({
+ where: eq(columnTable.id, id),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, { message: "Column not found" });
+ }
+
+ const [updated] = await db
+ .update(columnTable)
+ .set({
+ ...(data.name !== undefined && { name: data.name }),
+ ...(data.icon !== undefined && { icon: data.icon }),
+ ...(data.color !== undefined && { color: data.color }),
+ ...(data.isFinal !== undefined && { isFinal: data.isFinal }),
+ })
+ .where(eq(columnTable.id, id))
+ .returning();
+
+ if (!updated) {
+ throw new HTTPException(500, { message: "Failed to update column" });
+ }
+
+ return updated;
+}
+
+export default updateColumn;
diff --git a/apps/api/src/column/index.ts b/apps/api/src/column/index.ts
new file mode 100644
index 000000000..f0e6ae1f6
--- /dev/null
+++ b/apps/api/src/column/index.ts
@@ -0,0 +1,170 @@
+import { Hono } from "hono";
+import { describeRoute, resolver, validator } from "hono-openapi";
+import * as v from "valibot";
+import { workspaceAccess } from "../utils/workspace-access-middleware";
+import createColumn from "./controllers/create-column";
+import deleteColumn from "./controllers/delete-column";
+import getColumns from "./controllers/get-columns";
+import reorderColumns from "./controllers/reorder-columns";
+import updateColumn from "./controllers/update-column";
+
+const column = new Hono<{
+ Variables: {
+ userId: string;
+ };
+}>()
+ .get(
+ "/:projectId",
+ describeRoute({
+ operationId: "getColumns",
+ tags: ["Columns"],
+ description: "Get all columns for a project",
+ responses: {
+ 200: {
+ description: "List of columns ordered by position",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const columns = await getColumns(projectId);
+ return c.json(columns);
+ },
+ )
+ .post(
+ "/:projectId",
+ describeRoute({
+ operationId: "createColumn",
+ tags: ["Columns"],
+ description: "Create a new column in a project",
+ responses: {
+ 200: {
+ description: "Column created successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ validator(
+ "json",
+ v.object({
+ name: v.string(),
+ icon: v.optional(v.string()),
+ color: v.optional(v.string()),
+ isFinal: v.optional(v.boolean()),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const { name, icon, color, isFinal } = c.req.valid("json");
+ const result = await createColumn({
+ projectId,
+ name,
+ icon,
+ color,
+ isFinal,
+ });
+ return c.json(result);
+ },
+ )
+ .put(
+ "/reorder/:projectId",
+ describeRoute({
+ operationId: "reorderColumns",
+ tags: ["Columns"],
+ description: "Reorder columns in a project",
+ responses: {
+ 200: {
+ description: "Columns reordered successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ validator(
+ "json",
+ v.object({
+ columns: v.array(
+ v.object({
+ id: v.string(),
+ position: v.number(),
+ }),
+ ),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const { columns } = c.req.valid("json");
+ const result = await reorderColumns(projectId, columns);
+ return c.json(result);
+ },
+ )
+ .put(
+ "/:id",
+ describeRoute({
+ operationId: "updateColumn",
+ tags: ["Columns"],
+ description: "Update a column",
+ responses: {
+ 200: {
+ description: "Column updated successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ id: v.string() })),
+ validator(
+ "json",
+ v.object({
+ name: v.optional(v.string()),
+ icon: v.optional(v.nullable(v.string())),
+ color: v.optional(v.nullable(v.string())),
+ isFinal: v.optional(v.boolean()),
+ }),
+ ),
+ workspaceAccess.fromColumn("id"),
+ async (c) => {
+ const { id } = c.req.valid("param");
+ const data = c.req.valid("json");
+ const result = await updateColumn(id, data);
+ return c.json(result);
+ },
+ )
+ .delete(
+ "/:id",
+ describeRoute({
+ operationId: "deleteColumn",
+ tags: ["Columns"],
+ description: "Delete a column",
+ responses: {
+ 200: {
+ description: "Column deleted successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ id: v.string() })),
+ workspaceAccess.fromColumn("id"),
+ async (c) => {
+ const { id } = c.req.valid("param");
+ const result = await deleteColumn(id);
+ return c.json(result);
+ },
+ );
+
+export default column;
diff --git a/apps/api/src/database/index.ts b/apps/api/src/database/index.ts
index 63d5b72cd..75c6d9d72 100644
--- a/apps/api/src/database/index.ts
+++ b/apps/api/src/database/index.ts
@@ -5,6 +5,7 @@ import {
accountTableRelations,
activityTableRelations,
apikeyTableRelations,
+ columnTableRelations,
externalLinkTableRelations,
githubIntegrationTableRelations,
integrationTableRelations,
@@ -19,6 +20,7 @@ import {
timeEntryTableRelations,
userTableRelations,
verificationTableRelations,
+ workflowRuleTableRelations,
workspaceTableRelations,
workspaceUserTableRelations,
} from "./relations";
@@ -26,6 +28,7 @@ import {
accountTable,
activityTable,
apikeyTable,
+ columnTable,
externalLinkTable,
githubIntegrationTable,
integrationTable,
@@ -40,6 +43,7 @@ import {
timeEntryTable,
userTable,
verificationTable,
+ workflowRuleTable,
workspaceTable,
workspaceUserTable,
} from "./schema";
@@ -56,6 +60,7 @@ export const schema = {
accountTable,
activityTable,
apikeyTable,
+ columnTable,
externalLinkTable,
githubIntegrationTable,
integrationTable,
@@ -70,11 +75,13 @@ export const schema = {
timeEntryTable,
userTable,
verificationTable,
+ workflowRuleTable,
workspaceTable,
workspaceUserTable,
accountTableRelations,
activityTableRelations,
apikeyTableRelations,
+ columnTableRelations,
externalLinkTableRelations,
githubIntegrationTableRelations,
integrationTableRelations,
@@ -89,6 +96,7 @@ export const schema = {
timeEntryTableRelations,
userTableRelations,
verificationTableRelations,
+ workflowRuleTableRelations,
workspaceTableRelations,
workspaceUserTableRelations,
};
diff --git a/apps/api/src/database/relations.ts b/apps/api/src/database/relations.ts
index c1f8bd15e..f870116f3 100644
--- a/apps/api/src/database/relations.ts
+++ b/apps/api/src/database/relations.ts
@@ -3,6 +3,7 @@ import {
accountTable,
activityTable,
apikeyTable,
+ columnTable,
externalLinkTable,
githubIntegrationTable,
integrationTable,
@@ -17,6 +18,7 @@ import {
timeEntryTable,
userTable,
verificationTable,
+ workflowRuleTable,
workspaceTable,
workspaceUserTable,
} from "./schema";
@@ -86,11 +88,36 @@ export const projectTableRelations = relations(
references: [workspaceTable.id],
}),
tasks: many(taskTable),
+ columns: many(columnTable),
+ workflowRules: many(workflowRuleTable),
githubIntegration: many(githubIntegrationTable),
integrations: many(integrationTable),
}),
);
+export const columnTableRelations = relations(columnTable, ({ one, many }) => ({
+ project: one(projectTable, {
+ fields: [columnTable.projectId],
+ references: [projectTable.id],
+ }),
+ tasks: many(taskTable),
+ workflowRules: many(workflowRuleTable),
+}));
+
+export const workflowRuleTableRelations = relations(
+ workflowRuleTable,
+ ({ one }) => ({
+ project: one(projectTable, {
+ fields: [workflowRuleTable.projectId],
+ references: [projectTable.id],
+ }),
+ column: one(columnTable, {
+ fields: [workflowRuleTable.columnId],
+ references: [columnTable.id],
+ }),
+ }),
+);
+
export const taskTableRelations = relations(taskTable, ({ one, many }) => ({
project: one(projectTable, {
fields: [taskTable.projectId],
@@ -100,6 +127,10 @@ export const taskTableRelations = relations(taskTable, ({ one, many }) => ({
fields: [taskTable.userId],
references: [userTable.id],
}),
+ column: one(columnTable, {
+ fields: [taskTable.columnId],
+ references: [columnTable.id],
+ }),
timeEntries: many(timeEntryTable),
activities: many(activityTable),
labels: many(labelTable),
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index fd019dfdb..9374f9334 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -209,6 +209,62 @@ export const projectTable = pgTable("project", {
isPublic: boolean("is_public").default(false),
});
+export const columnTable = pgTable(
+ "column",
+ {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ projectId: text("project_id")
+ .notNull()
+ .references(() => projectTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ name: text("name").notNull(),
+ slug: text("slug").notNull(),
+ position: integer("position").notNull().default(0),
+ icon: text("icon"),
+ color: text("color"),
+ isFinal: boolean("is_final").default(false).notNull(),
+ createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ updatedAt: timestamp("updated_at", { mode: "date" })
+ .defaultNow()
+ .$onUpdate(() => new Date())
+ .notNull(),
+ },
+ (table) => [index("column_projectId_idx").on(table.projectId)],
+);
+
+export const workflowRuleTable = pgTable(
+ "workflow_rule",
+ {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ projectId: text("project_id")
+ .notNull()
+ .references(() => projectTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ integrationType: text("integration_type").notNull(),
+ eventType: text("event_type").notNull(),
+ columnId: text("column_id")
+ .notNull()
+ .references(() => columnTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ updatedAt: timestamp("updated_at", { mode: "date" })
+ .defaultNow()
+ .$onUpdate(() => new Date())
+ .notNull(),
+ },
+ (table) => [index("workflow_rule_projectId_idx").on(table.projectId)],
+);
+
export const taskTable = pgTable("task", {
id: text("id")
.$defaultFn(() => createId())
@@ -228,6 +284,10 @@ export const taskTable = pgTable("task", {
title: text("title").notNull(),
description: text("description"),
status: text("status").notNull().default("to-do"),
+ columnId: text("column_id").references(() => columnTable.id, {
+ onDelete: "set null",
+ onUpdate: "cascade",
+ }),
priority: text("priority").default("low"),
dueDate: timestamp("due_date", { mode: "date" }),
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 5469f2295..a5784f9d3 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -7,6 +7,7 @@ import { HTTPException } from "hono/http-exception";
import { openAPIRouteHandler } from "hono-openapi";
import activity from "./activity";
import { auth } from "./auth";
+import column from "./column";
import config from "./config";
import db from "./database";
import externalLink from "./external-link";
@@ -15,6 +16,7 @@ import githubIntegration, {
} from "./github-integration";
import invitation from "./invitation";
import label from "./label";
+import { migrateColumns } from "./migrations/column-migration";
import notification from "./notification";
import { initializePlugins } from "./plugins";
import { migrateGitHubIntegration } from "./plugins/github/migration";
@@ -27,6 +29,7 @@ import { getInvitationDetails } from "./utils/check-registration-allowed";
import { migrateSessionColumn } from "./utils/migrate-session-column";
import { migrateWorkspaceUserEmail } from "./utils/migrate-workspace-user-email";
import { verifyApiKey } from "./utils/verify-api-key";
+import workflowRule from "./workflow-rule";
type ApiKey = {
id: string;
@@ -176,6 +179,7 @@ api.use("*", async (c, next) => {
const projectApi = api.route("/project", project);
const taskApi = api.route("/task", task);
+const columnApi = api.route("/column", column);
const activityApi = api.route("/activity", activity);
const timeEntryApi = api.route("/time-entry", timeEntry);
const labelApi = api.route("/label", label);
@@ -186,6 +190,7 @@ const githubIntegrationApi = api.route(
githubIntegration,
);
const externalLinkApi = api.route("/external-link", externalLink);
+const workflowRuleApi = api.route("/workflow-rule", workflowRule);
const invitationApi = api.route("/invitation", invitation);
app.route("/api", api);
@@ -202,6 +207,7 @@ app.route("/api", api);
console.log("✅ Database migrated successfully!");
await migrateGitHubIntegration();
+ await migrateColumns();
initializePlugins();
} catch (error) {
@@ -226,6 +232,7 @@ export type AppType =
| typeof configApi
| typeof projectApi
| typeof taskApi
+ | typeof columnApi
| typeof activityApi
| typeof timeEntryApi
| typeof labelApi
@@ -233,6 +240,7 @@ export type AppType =
| typeof searchApi
| typeof githubIntegrationApi
| typeof externalLinkApi
+ | typeof workflowRuleApi
| typeof invitationApi
| typeof invitationPublicApi;
diff --git a/apps/api/src/migrations/column-migration.ts b/apps/api/src/migrations/column-migration.ts
new file mode 100644
index 000000000..b0276b7f7
--- /dev/null
+++ b/apps/api/src/migrations/column-migration.ts
@@ -0,0 +1,165 @@
+import { and, eq, sql } from "drizzle-orm";
+import db from "../database";
+import {
+ columnTable,
+ integrationTable,
+ projectTable,
+ taskTable,
+ workflowRuleTable,
+} from "../database/schema";
+
+const DEFAULT_COLUMNS = [
+ { name: "To Do", slug: "to-do", position: 0, isFinal: false },
+ { name: "In Progress", slug: "in-progress", position: 1, isFinal: false },
+ { name: "In Review", slug: "in-review", position: 2, isFinal: false },
+ { name: "Done", slug: "done", position: 3, isFinal: true },
+];
+
+const EVENT_MAPPING: Record<string, string> = {
+ onBranchPush: "branch_push",
+ onPROpen: "pr_opened",
+ onPRMerge: "pr_merged",
+};
+
+export async function migrateColumns() {
+ console.log("🔄 Starting column migration...");
+
+ const projects = await db.select().from(projectTable);
+
+ if (projects.length === 0) {
+ console.log("No projects found, skipping column migration");
+ return;
+ }
+
+ for (const project of projects) {
+ const projectColumns = await db
+ .select({
+ id: columnTable.id,
+ slug: columnTable.slug,
+ })
+ .from(columnTable)
+ .where(eq(columnTable.projectId, project.id));
+
+ const columnMap = new Map<string, string>(
+ projectColumns.map((column) => [column.slug, column.id]),
+ );
+
+ for (const defaultColumn of DEFAULT_COLUMNS) {
+ if (columnMap.has(defaultColumn.slug)) {
+ continue;
+ }
+
+ const [inserted] = await db
+ .insert(columnTable)
+ .values({
+ projectId: project.id,
+ name: defaultColumn.name,
+ slug: defaultColumn.slug,
+ position: defaultColumn.position,
+ isFinal: defaultColumn.isFinal,
+ })
+ .returning({ id: columnTable.id, slug: columnTable.slug });
+
+ if (inserted) {
+ columnMap.set(inserted.slug, inserted.id);
+ }
+ }
+
+ for (const [slug, columnId] of columnMap) {
+ await db
+ .update(taskTable)
+ .set({ columnId })
+ .where(
+ sql`${taskTable.projectId} = ${project.id}
+ AND ${taskTable.status} = ${slug}
+ AND ${taskTable.columnId} IS DISTINCT FROM ${columnId}`,
+ );
+ }
+
+ const integrations = await db.query.integrationTable.findMany({
+ where: eq(integrationTable.projectId, project.id),
+ });
+
+ for (const integration of integrations) {
+ if (integration.type !== "github" || !integration.isActive) continue;
+
+ try {
+ const config = JSON.parse(integration.config);
+ const transitions = config.statusTransitions || {};
+
+ for (const [configKey, eventType] of Object.entries(EVENT_MAPPING)) {
+ const targetSlug = transitions[configKey];
+ if (!targetSlug) continue;
+
+ const targetColumnId = columnMap.get(targetSlug);
+ if (!targetColumnId) continue;
+
+ await upsertMigrationWorkflowRule(
+ project.id,
+ eventType as string,
+ targetColumnId,
+ );
+ }
+
+ // Add default rules for issue events
+ const todoColumnId = columnMap.get("to-do");
+ const doneColumnId = columnMap.get("done");
+
+ if (todoColumnId) {
+ await upsertMigrationWorkflowRule(
+ project.id,
+ "issue_opened",
+ todoColumnId,
+ );
+ }
+
+ if (doneColumnId) {
+ await upsertMigrationWorkflowRule(
+ project.id,
+ "issue_closed",
+ doneColumnId,
+ );
+ }
+ } catch {
+ console.error(
+ `Failed to migrate workflow rules for integration ${integration.id}`,
+ );
+ }
+ }
+ }
+
+ console.log(
+ `✅ Column migration complete! Migrated ${projects.length} projects`,
+ );
+}
+
+async function upsertMigrationWorkflowRule(
+ projectId: string,
+ eventType: string,
+ columnId: string,
+) {
+ const existing = await db.query.workflowRuleTable.findFirst({
+ where: and(
+ eq(workflowRuleTable.projectId, projectId),
+ eq(workflowRuleTable.integrationType, "github"),
+ eq(workflowRuleTable.eventType, eventType),
+ ),
+ });
+
+ if (!existing) {
+ await db.insert(workflowRuleTable).values({
+ projectId,
+ integrationType: "github",
+ eventType,
+ columnId,
+ });
+ return;
+ }
+
+ if (existing.columnId !== columnId) {
+ await db
+ .update(workflowRuleTable)
+ .set({ columnId })
+ .where(eq(workflowRuleTable.id, existing.id));
+ }
+}
diff --git a/apps/api/src/plugins/github/services/task-service.ts b/apps/api/src/plugins/github/services/task-service.ts
index 0723eb792..73723a725 100644
--- a/apps/api/src/plugins/github/services/task-service.ts
+++ b/apps/api/src/plugins/github/services/task-service.ts
@@ -1,6 +1,10 @@
import { and, eq } from "drizzle-orm";
import db from "../../../database";
-import { integrationTable, taskTable } from "../../../database/schema";
+import {
+ columnTable,
+ integrationTable,
+ taskTable,
+} from "../../../database/schema";
export async function findTaskByNumber(projectId: string, taskNumber: number) {
return db.query.taskTable.findFirst({
@@ -18,9 +22,24 @@ export async function findTaskById(taskId: string) {
}
export async function updateTaskStatus(taskId: string, newStatus: string) {
+ const task = await db.query.taskTable.findFirst({
+ where: eq(taskTable.id, taskId),
+ });
+
+ let columnId: string | null = null;
+ if (task) {
+ const column = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, task.projectId),
+ eq(columnTable.slug, newStatus),
+ ),
+ });
+ columnId = column?.id ?? null;
+ }
+
await db
.update(taskTable)
- .set({ status: newStatus })
+ .set({ status: newStatus, columnId })
.where(eq(taskTable.id, taskId));
}
diff --git a/apps/api/src/plugins/github/utils/resolve-column.ts b/apps/api/src/plugins/github/utils/resolve-column.ts
new file mode 100644
index 000000000..94355f776
--- /dev/null
+++ b/apps/api/src/plugins/github/utils/resolve-column.ts
@@ -0,0 +1,27 @@
+import { and, eq } from "drizzle-orm";
+import db from "../../../database";
+import { columnTable, workflowRuleTable } from "../../../database/schema";
+
+export async function resolveTargetStatus(
+ projectId: string,
+ eventType: string,
+ fallbackStatus: string,
+): Promise<string> {
+ const rule = await db.query.workflowRuleTable.findFirst({
+ where: and(
+ eq(workflowRuleTable.projectId, projectId),
+ eq(workflowRuleTable.integrationType, "github"),
+ eq(workflowRuleTable.eventType, eventType),
+ ),
+ });
+
+ if (!rule) {
+ return fallbackStatus;
+ }
+
+ const column = await db.query.columnTable.findFirst({
+ where: eq(columnTable.id, rule.columnId),
+ });
+
+ return column?.slug ?? fallbackStatus;
+}
diff --git a/apps/api/src/plugins/github/webhooks/issue-closed.ts b/apps/api/src/plugins/github/webhooks/issue-closed.ts
index 3c33b749d..f63f11f5e 100644
--- a/apps/api/src/plugins/github/webhooks/issue-closed.ts
+++ b/apps/api/src/plugins/github/webhooks/issue-closed.ts
@@ -2,7 +2,11 @@ import { and, eq } from "drizzle-orm";
import db from "../../../database";
import { externalLinkTable, taskTable } from "../../../database/schema";
import { updateExternalLink } from "../services/link-manager";
-import { findAllIntegrationsByRepo } from "../services/task-service";
+import {
+ findAllIntegrationsByRepo,
+ updateTaskStatus,
+} from "../services/task-service";
+import { resolveTargetStatus } from "../utils/resolve-column";
type IssueClosedPayload = {
action: string;
@@ -56,10 +60,13 @@ export async function handleIssueClosed(payload: IssueClosedPayload) {
continue;
}
- await db
- .update(taskTable)
- .set({ status: "done" })
- .where(eq(taskTable.id, task.id));
+ const targetStatus = await resolveTargetStatus(
+ task.projectId,
+ "issue_closed",
+ "done",
+ );
+
+ await updateTaskStatus(task.id, targetStatus);
await updateExternalLink(externalLink.id, {
metadata: {
diff --git a/apps/api/src/plugins/github/webhooks/issue-opened.ts b/apps/api/src/plugins/github/webhooks/issue-opened.ts
index 0f5244020..5671ff26e 100644
--- a/apps/api/src/plugins/github/webhooks/issue-opened.ts
+++ b/apps/api/src/plugins/github/webhooks/issue-opened.ts
@@ -1,6 +1,6 @@
-import { eq } from "drizzle-orm";
+import { and, eq } from "drizzle-orm";
import db from "../../../database";
-import { projectTable, taskTable } from "../../../database/schema";
+import { columnTable, projectTable, taskTable } from "../../../database/schema";
import getNextTaskNumber from "../../../task/controllers/get-next-task-number";
import type { GitHubConfig } from "../config";
import { createExternalLink, findExternalLink } from "../services/link-manager";
@@ -12,6 +12,7 @@ import {
import { formatTaskDescriptionFromIssue } from "../utils/format";
import { getGithubApp } from "../utils/github-app";
import { addLabelsToIssue } from "../utils/labels";
+import { resolveTargetStatus } from "../utils/resolve-column";
type IssueOpenedPayload = {
action: string;
@@ -69,18 +70,32 @@ export async function handleIssueOpened(payload: IssueOpenedPayload) {
const nextTaskNumber = await getNextTaskNumber(projectId);
+ const resolvedStatus = await resolveTargetStatus(
+ projectId,
+ "issue_opened",
+ "to-do",
+ );
+
+ const targetStatus = status || resolvedStatus;
+ const targetColumn = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, projectId),
+ eq(columnTable.slug, targetStatus),
+ ),
+ });
+
const taskValues: typeof taskTable.$inferInsert = {
projectId,
userId: null,
title: issue.title,
description: formatTaskDescriptionFromIssue(issue.body),
- status: "to-do",
+ status: targetStatus,
+ columnId: targetColumn?.id ?? null,
priority: null,
number: nextTaskNumber + 1,
};
if (priority) taskValues.priority = priority;
- if (status) taskValues.status = status;
const [createdTask] = await db
.insert(taskTable)
diff --git a/apps/api/src/plugins/github/webhooks/pull-request-closed.ts b/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
index 49dc48be2..471a24b72 100644
--- a/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
+++ b/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
@@ -8,6 +8,7 @@ import {
findTaskById,
updateTaskStatus,
} from "../services/task-service";
+import { resolveTargetStatus } from "../utils/resolve-column";
type PRClosedPayload = {
action: string;
@@ -85,7 +86,11 @@ export async function handlePullRequestClosed(payload: PRClosedPayload) {
});
if (!hasOpenPRs) {
- const targetStatus = config.statusTransitions?.onPRMerge || "done";
+ const targetStatus = await resolveTargetStatus(
+ integration.projectId,
+ "pr_merged",
+ config.statusTransitions?.onPRMerge || "done",
+ );
await updateTaskStatus(task.id, targetStatus);
}
}
diff --git a/apps/api/src/plugins/github/webhooks/pull-request-opened.ts b/apps/api/src/plugins/github/webhooks/pull-request-opened.ts
index 66bb36589..304d8d137 100644
--- a/apps/api/src/plugins/github/webhooks/pull-request-opened.ts
+++ b/apps/api/src/plugins/github/webhooks/pull-request-opened.ts
@@ -6,6 +6,7 @@ import {
updateTaskStatus,
} from "../services/task-service";
import { extractTaskNumber } from "../utils/branch-matcher";
+import { resolveTargetStatus } from "../utils/resolve-column";
type PROpenedPayload = {
action: string;
@@ -89,7 +90,11 @@ export async function handlePullRequestOpened(payload: PROpenedPayload) {
},
});
- const targetStatus = config.statusTransitions?.onPROpen || "in-review";
+ const targetStatus = await resolveTargetStatus(
+ integration.projectId,
+ "pr_opened",
+ config.statusTransitions?.onPROpen || "in-review",
+ );
if (task.status !== targetStatus && task.status !== "done") {
await updateTaskStatus(task.id, targetStatus);
diff --git a/apps/api/src/plugins/github/webhooks/push.ts b/apps/api/src/plugins/github/webhooks/push.ts
index f4ceb03c4..1a84e6444 100644
--- a/apps/api/src/plugins/github/webhooks/push.ts
+++ b/apps/api/src/plugins/github/webhooks/push.ts
@@ -6,6 +6,7 @@ import {
updateTaskStatus,
} from "../services/task-service";
import { extractTaskNumberFromBranch } from "../utils/branch-matcher";
+import { resolveTargetStatus } from "../utils/resolve-column";
type PushPayload = {
ref: string;
@@ -117,8 +118,11 @@ export async function handlePush(payload: PushPayload) {
},
});
- const targetStatus =
- config.statusTransitions?.onBranchPush || "in-progress";
+ const targetStatus = await resolveTargetStatus(
+ integration.projectId,
+ "branch_push",
+ config.statusTransitions?.onBranchPush || "in-progress",
+ );
console.log(
`[Push] Target status: ${targetStatus}, current: ${task.status}`,
);
diff --git a/apps/api/src/project/controllers/create-project.ts b/apps/api/src/project/controllers/create-project.ts
index 066e47783..b1acd8048 100644
--- a/apps/api/src/project/controllers/create-project.ts
+++ b/apps/api/src/project/controllers/create-project.ts
@@ -1,5 +1,12 @@
import db from "../../database";
-import { projectTable } from "../../database/schema";
+import { columnTable, projectTable } from "../../database/schema";
+
+const DEFAULT_COLUMNS = [
+ { name: "To Do", slug: "to-do", position: 0, isFinal: false },
+ { name: "In Progress", slug: "in-progress", position: 1, isFinal: false },
+ { name: "In Review", slug: "in-review", position: 2, isFinal: false },
+ { name: "Done", slug: "done", position: 3, isFinal: true },
+];
async function createProject(
workspaceId: string,
@@ -17,6 +24,18 @@ async function createProject(
})
.returning();
+ if (createdProject) {
+ for (const col of DEFAULT_COLUMNS) {
+ await db.insert(columnTable).values({
+ projectId: createdProject.id,
+ name: col.name,
+ slug: col.slug,
+ position: col.position,
+ isFinal: col.isFinal,
+ });
+ }
+ }
+
return createdProject;
}
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index c3f6afb94..fa0c737b1 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -28,14 +28,7 @@ export const taskSchema = v.object({
userId: v.nullable(v.string()),
title: v.string(),
description: v.nullable(v.string()),
- status: v.picklist([
- "to-do",
- "in-progress",
- "in-review",
- "done",
- "archived",
- "planned",
- ] as const),
+ status: v.string(),
priority: v.picklist([
"no-priority",
"low",
diff --git a/apps/api/src/task/controllers/create-task.ts b/apps/api/src/task/controllers/create-task.ts
index e7ffa079c..c5413e86d 100644
--- a/apps/api/src/task/controllers/create-task.ts
+++ b/apps/api/src/task/controllers/create-task.ts
@@ -1,7 +1,7 @@
-import { eq } from "drizzle-orm";
+import { and, eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { taskTable, userTable } from "../../database/schema";
+import { columnTable, taskTable, userTable } from "../../database/schema";
import { publishEvent } from "../../events";
import getNextTaskNumber from "./get-next-task-number";
@@ -29,6 +29,13 @@ async function createTask({
const nextTaskNumber = await getNextTaskNumber(projectId);
+ const column = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, projectId),
+ eq(columnTable.slug, status || "to-do"),
+ ),
+ });
+
const [createdTask] = await db
.insert(taskTable)
.values({
@@ -36,6 +43,7 @@ async function createTask({
userId: userId || null,
title: title || "",
status: status || "",
+ columnId: column?.id ?? null,
dueDate: dueDate || null,
description: description || "",
priority: priority || "",
diff --git a/apps/api/src/task/controllers/get-tasks.ts b/apps/api/src/task/controllers/get-tasks.ts
index 7c7dd632d..bfc42949b 100644
--- a/apps/api/src/task/controllers/get-tasks.ts
+++ b/apps/api/src/task/controllers/get-tasks.ts
@@ -1,7 +1,8 @@
-import { eq, inArray } from "drizzle-orm";
+import { asc, eq, inArray } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
import {
+ columnTable,
externalLinkTable,
labelTable,
projectTable,
@@ -9,13 +10,6 @@ import {
userTable,
} from "../../database/schema";
-const DEFAULT_COLUMNS = [
- { id: "to-do", name: "To Do" },
- { id: "in-progress", name: "In Progress" },
- { id: "in-review", name: "In Review" },
- { id: "done", name: "Done" },
-] as const;
-
async function getTasks(projectId: string) {
const project = await db.query.projectTable.findFirst({
where: eq(projectTable.id, projectId),
@@ -115,11 +109,18 @@ async function getTasks(projectId: string) {
});
}
- const columns = DEFAULT_COLUMNS.map((column) => ({
- id: column.id,
+ const projectColumns = await db
+ .select()
+ .from(columnTable)
+ .where(eq(columnTable.projectId, projectId))
+ .orderBy(asc(columnTable.position));
+
+ const columns = projectColumns.map((column) => ({
+ id: column.slug,
name: column.name,
+ isFinal: column.isFinal,
tasks: tasks
- .filter((task) => task.status === column.id)
+ .filter((task) => task.status === column.slug)
.map((task) => ({
...task,
labels: taskLabelsMap.get(task.id) || [],
diff --git a/apps/api/src/task/controllers/import-tasks.ts b/apps/api/src/task/controllers/import-tasks.ts
index 2ae3bd598..215b19d39 100644
--- a/apps/api/src/task/controllers/import-tasks.ts
+++ b/apps/api/src/task/controllers/import-tasks.ts
@@ -1,7 +1,7 @@
-import { eq } from "drizzle-orm";
+import { and, eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { projectTable, taskTable } from "../../database/schema";
+import { columnTable, projectTable, taskTable } from "../../database/schema";
import { publishEvent } from "../../events";
import getNextTaskNumber from "./get-next-task-number";
@@ -32,6 +32,13 @@ async function importTasks(projectId: string, tasksToImport: ImportTask[]) {
for (const taskData of tasksToImport) {
try {
+ const column = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, projectId),
+ eq(columnTable.slug, taskData.status),
+ ),
+ });
+
const [createdTask] = await db
.insert(taskTable)
.values({
@@ -39,6 +46,7 @@ async function importTasks(projectId: string, tasksToImport: ImportTask[]) {
userId: taskData.userId || null,
title: taskData.title,
status: taskData.status,
+ columnId: column?.id ?? null,
dueDate: taskData.dueDate ? new Date(taskData.dueDate) : null,
description: taskData.description || "",
priority: taskData.priority || "low",
diff --git a/apps/api/src/task/controllers/update-task-status.ts b/apps/api/src/task/controllers/update-task-status.ts
index 46e2879b5..2dfc99539 100644
--- a/apps/api/src/task/controllers/update-task-status.ts
+++ b/apps/api/src/task/controllers/update-task-status.ts
@@ -1,7 +1,7 @@
-import { eq } from "drizzle-orm";
+import { and, eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { taskTable } from "../../database/schema";
+import { columnTable, taskTable } from "../../database/schema";
async function updateTaskStatus({
id,
@@ -20,7 +20,17 @@ async function updateTaskStatus({
});
}
- await db.update(taskTable).set({ status }).where(eq(taskTable.id, id));
+ const column = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, updatedTask.projectId),
+ eq(columnTable.slug, status),
+ ),
+ });
+
+ await db
+ .update(taskTable)
+ .set({ status, columnId: column?.id ?? null })
+ .where(eq(taskTable.id, id));
return updatedTask;
}
diff --git a/apps/api/src/task/controllers/update-task.ts b/apps/api/src/task/controllers/update-task.ts
index 25053545e..2f97c2038 100644
--- a/apps/api/src/task/controllers/update-task.ts
+++ b/apps/api/src/task/controllers/update-task.ts
@@ -1,7 +1,7 @@
-import { eq } from "drizzle-orm";
+import { and, eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { taskTable } from "../../database/schema";
+import { columnTable, taskTable } from "../../database/schema";
async function updateTask(
id: string,
@@ -24,11 +24,19 @@ async function updateTask(
});
}
+ const column = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.projectId, projectId),
+ eq(columnTable.slug, status),
+ ),
+ });
+
const [updatedTask] = await db
.update(taskTable)
.set({
title,
status,
+ columnId: column?.id ?? null,
dueDate: dueDate || null,
projectId,
description,
diff --git a/apps/api/src/utils/workspace-access-middleware.ts b/apps/api/src/utils/workspace-access-middleware.ts
index 39b37a7cc..9b0b67986 100644
--- a/apps/api/src/utils/workspace-access-middleware.ts
+++ b/apps/api/src/utils/workspace-access-middleware.ts
@@ -10,7 +10,14 @@ type WorkspaceIdSource =
| { type: "param"; key: string }
| {
type: "lookup";
- resource: "project" | "task" | "label" | "timeEntry" | "activity";
+ resource:
+ | "project"
+ | "task"
+ | "label"
+ | "timeEntry"
+ | "activity"
+ | "column"
+ | "workflowRule";
idKey: string;
};
@@ -72,7 +79,14 @@ export function workspaceAccessMiddleware(
}
async function lookupWorkspaceId(
- resource: "project" | "task" | "label" | "timeEntry" | "activity",
+ resource:
+ | "project"
+ | "task"
+ | "label"
+ | "timeEntry"
+ | "activity"
+ | "column"
+ | "workflowRule",
id: string,
): Promise<string | null> {
try {
@@ -148,6 +162,36 @@ async function lookupWorkspaceId(
return activity?.workspaceId || null;
}
+ case "column": {
+ const [column] = await db
+ .select({
+ workspaceId: schema.projectTable.workspaceId,
+ })
+ .from(schema.columnTable)
+ .innerJoin(
+ schema.projectTable,
+ eq(schema.columnTable.projectId, schema.projectTable.id),
+ )
+ .where(eq(schema.columnTable.id, id))
+ .limit(1);
+ return column?.workspaceId || null;
+ }
+
+ case "workflowRule": {
+ const [workflowRule] = await db
+ .select({
+ workspaceId: schema.projectTable.workspaceId,
+ })
+ .from(schema.workflowRuleTable)
+ .innerJoin(
+ schema.projectTable,
+ eq(schema.workflowRuleTable.projectId, schema.projectTable.id),
+ )
+ .where(eq(schema.workflowRuleTable.id, id))
+ .limit(1);
+ return workflowRule?.workspaceId || null;
+ }
+
default:
return null;
}
@@ -199,4 +243,14 @@ export const workspaceAccess = {
workspaceAccessMiddleware({
sources: [{ type: "lookup", resource: "activity", idKey }],
}),
+
+ fromColumn: (idKey = "id") =>
+ workspaceAccessMiddleware({
+ sources: [{ type: "lookup", resource: "column", idKey }],
+ }),
+
+ fromWorkflowRule: (idKey = "id") =>
+ workspaceAccessMiddleware({
+ sources: [{ type: "lookup", resource: "workflowRule", idKey }],
+ }),
};
diff --git a/apps/api/src/workflow-rule/controllers/delete-workflow-rule.ts b/apps/api/src/workflow-rule/controllers/delete-workflow-rule.ts
new file mode 100644
index 000000000..867cd9fd1
--- /dev/null
+++ b/apps/api/src/workflow-rule/controllers/delete-workflow-rule.ts
@@ -0,0 +1,20 @@
+import { eq } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { workflowRuleTable } from "../../database/schema";
+
+async function deleteWorkflowRule(id: string) {
+ const existing = await db.query.workflowRuleTable.findFirst({
+ where: eq(workflowRuleTable.id, id),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, { message: "Workflow rule not found" });
+ }
+
+ await db.delete(workflowRuleTable).where(eq(workflowRuleTable.id, id));
+
+ return existing;
+}
+
+export default deleteWorkflowRule;
diff --git a/apps/api/src/workflow-rule/controllers/get-workflow-rules.ts b/apps/api/src/workflow-rule/controllers/get-workflow-rules.ts
new file mode 100644
index 000000000..7a4668dd1
--- /dev/null
+++ b/apps/api/src/workflow-rule/controllers/get-workflow-rules.ts
@@ -0,0 +1,25 @@
+import { eq } from "drizzle-orm";
+import db from "../../database";
+import { columnTable, workflowRuleTable } from "../../database/schema";
+
+async function getWorkflowRules(projectId: string) {
+ const rules = await db
+ .select({
+ id: workflowRuleTable.id,
+ projectId: workflowRuleTable.projectId,
+ integrationType: workflowRuleTable.integrationType,
+ eventType: workflowRuleTable.eventType,
+ columnId: workflowRuleTable.columnId,
+ columnName: columnTable.name,
+ columnSlug: columnTable.slug,
+ createdAt: workflowRuleTable.createdAt,
+ updatedAt: workflowRuleTable.updatedAt,
+ })
+ .from(workflowRuleTable)
+ .leftJoin(columnTable, eq(workflowRuleTable.columnId, columnTable.id))
+ .where(eq(workflowRuleTable.projectId, projectId));
+
+ return rules;
+}
+
+export default getWorkflowRules;
diff --git a/apps/api/src/workflow-rule/controllers/upsert-workflow-rule.ts b/apps/api/src/workflow-rule/controllers/upsert-workflow-rule.ts
new file mode 100644
index 000000000..59c889d4f
--- /dev/null
+++ b/apps/api/src/workflow-rule/controllers/upsert-workflow-rule.ts
@@ -0,0 +1,73 @@
+import { and, eq } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { columnTable, workflowRuleTable } from "../../database/schema";
+
+async function upsertWorkflowRule({
+ projectId,
+ integrationType,
+ eventType,
+ columnId,
+}: {
+ projectId: string;
+ integrationType: string;
+ eventType: string;
+ columnId: string;
+}) {
+ const targetColumn = await db.query.columnTable.findFirst({
+ where: and(
+ eq(columnTable.id, columnId),
+ eq(columnTable.projectId, projectId),
+ ),
+ });
+
+ if (!targetColumn) {
+ throw new HTTPException(400, {
+ message: "Column does not belong to the provided project",
+ });
+ }
+
+ const existing = await db.query.workflowRuleTable.findFirst({
+ where: and(
+ eq(workflowRuleTable.projectId, projectId),
+ eq(workflowRuleTable.integrationType, integrationType),
+ eq(workflowRuleTable.eventType, eventType),
+ ),
+ });
+
+ if (existing) {
+ const [updated] = await db
+ .update(workflowRuleTable)
+ .set({ columnId })
+ .where(eq(workflowRuleTable.id, existing.id))
+ .returning();
+
+ if (!updated) {
+ throw new HTTPException(500, {
+ message: "Failed to update workflow rule",
+ });
+ }
+
+ return updated;
+ }
+
+ const [created] = await db
+ .insert(workflowRuleTable)
+ .values({
+ projectId,
+ integrationType,
+ eventType,
+ columnId,
+ })
+ .returning();
+
+ if (!created) {
+ throw new HTTPException(500, {
+ message: "Failed to create workflow rule",
+ });
+ }
+
+ return created;
+}
+
+export default upsertWorkflowRule;
diff --git a/apps/api/src/workflow-rule/index.ts b/apps/api/src/workflow-rule/index.ts
new file mode 100644
index 000000000..6bd4b9c58
--- /dev/null
+++ b/apps/api/src/workflow-rule/index.ts
@@ -0,0 +1,98 @@
+import { Hono } from "hono";
+import { describeRoute, resolver, validator } from "hono-openapi";
+import * as v from "valibot";
+import { workspaceAccess } from "../utils/workspace-access-middleware";
+import deleteWorkflowRule from "./controllers/delete-workflow-rule";
+import getWorkflowRules from "./controllers/get-workflow-rules";
+import upsertWorkflowRule from "./controllers/upsert-workflow-rule";
+
+const workflowRule = new Hono<{
+ Variables: {
+ userId: string;
+ };
+}>()
+ .get(
+ "/:projectId",
+ describeRoute({
+ operationId: "getWorkflowRules",
+ tags: ["Workflow Rules"],
+ description: "Get all workflow rules for a project",
+ responses: {
+ 200: {
+ description: "List of workflow rules",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const rules = await getWorkflowRules(projectId);
+ return c.json(rules);
+ },
+ )
+ .put(
+ "/:projectId",
+ describeRoute({
+ operationId: "upsertWorkflowRule",
+ tags: ["Workflow Rules"],
+ description: "Create or update a workflow rule",
+ responses: {
+ 200: {
+ description: "Workflow rule upserted successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ projectId: v.string() })),
+ validator(
+ "json",
+ v.object({
+ integrationType: v.string(),
+ eventType: v.string(),
+ columnId: v.string(),
+ }),
+ ),
+ workspaceAccess.fromProject("projectId"),
+ async (c) => {
+ const { projectId } = c.req.valid("param");
+ const { integrationType, eventType, columnId } = c.req.valid("json");
+ const result = await upsertWorkflowRule({
+ projectId,
+ integrationType,
+ eventType,
+ columnId,
+ });
+ return c.json(result);
+ },
+ )
+ .delete(
+ "/:id",
+ describeRoute({
+ operationId: "deleteWorkflowRule",
+ tags: ["Workflow Rules"],
+ description: "Delete a workflow rule",
+ responses: {
+ 200: {
+ description: "Workflow rule deleted successfully",
+ content: {
+ "application/json": { schema: resolver(v.any()) },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ id: v.string() })),
+ workspaceAccess.fromWorkflowRule("id"),
+ async (c) => {
+ const { id } = c.req.valid("param");
+ const result = await deleteWorkflowRule(id);
+ return c.json(result);
+ },
+ );
+
+export default workflowRule;
diff --git a/apps/docs/next-env.d.ts b/apps/docs/next-env.d.ts
index 9edff1c7c..c4b7818fb 100644
--- a/apps/docs/next-env.d.ts
+++ b/apps/docs/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/web/src/components/bulk-selection/backlog-bulk-toolbar.tsx b/apps/web/src/components/bulk-selection/backlog-bulk-toolbar.tsx
index 80d18f107..ac43aaa4f 100644
--- a/apps/web/src/components/bulk-selection/backlog-bulk-toolbar.tsx
+++ b/apps/web/src/components/bulk-selection/backlog-bulk-toolbar.tsx
@@ -27,11 +27,13 @@ import useActiveWorkspace from "@/hooks/queries/workspace/use-active-workspace";
import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-get-active-workspace-users";
import { getColumnIcon } from "@/lib/column";
import useBacklogBulkSelectionStore from "@/store/backlog-bulk-selection";
+import useProjectStore from "@/store/project";
import { Button } from "../ui/button";
function BacklogBulkToolbar() {
const { selectedTaskIds, clearSelection, selectAll } =
useBacklogBulkSelectionStore();
+ const { project } = useProjectStore();
const { bulkMoveToBoard, bulkDelete, bulkArchive, bulkAssign } =
useBulkOperations();
const { data: workspace } = useActiveWorkspace();
@@ -133,22 +135,15 @@ function BacklogBulkToolbar() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="center" className="w-48">
- <DropdownMenuItem onClick={() => handleMoveToBoard("to-do")}>
- {getColumnIcon("to-do")}
- <span className="ml-2">To Do</span>
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => handleMoveToBoard("in-progress")}>
- {getColumnIcon("in-progress")}
- <span className="ml-2">In Progress</span>
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => handleMoveToBoard("in-review")}>
- {getColumnIcon("in-review")}
- <span className="ml-2">In Review</span>
- </DropdownMenuItem>
- <DropdownMenuItem onClick={() => handleMoveToBoard("done")}>
- {getColumnIcon("done")}
- <span className="ml-2">Done</span>
- </DropdownMenuItem>
+ {(project?.columns ?? []).map((col) => (
+ <DropdownMenuItem
+ key={col.id}
+ onClick={() => handleMoveToBoard(col.id)}
+ >
+ {getColumnIcon(col.id)}
+ <span className="ml-2">{col.name}</span>
+ </DropdownMenuItem>
+ ))}
</DropdownMenuContent>
</DropdownMenu>
diff --git a/apps/web/src/components/bulk-selection/bulk-toolbar.tsx b/apps/web/src/components/bulk-selection/bulk-toolbar.tsx
index d32eb66b1..0c45f884a 100644
--- a/apps/web/src/components/bulk-selection/bulk-toolbar.tsx
+++ b/apps/web/src/components/bulk-selection/bulk-toolbar.tsx
@@ -14,11 +14,13 @@ import useActiveWorkspace from "@/hooks/queries/workspace/use-active-workspace";
import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-get-active-workspace-users";
import { getColumnIcon } from "@/lib/column";
import useBulkSelectionStore from "@/store/bulk-selection";
+import useProjectStore from "@/store/project";
import { Button } from "../ui/button";
function BulkToolbar() {
const { selectedTaskIds, clearSelection, selectAll } =
useBulkSelectionStore();
+ const { project } = useProjectStore();
const {
bulkMoveToBacklog,
bulkDelete,
@@ -166,22 +168,15 @@ function BulkToolbar() {
</CommandGroup>
<CommandGroup heading="Change Status">
- <CommandItem onSelect={() => handleBulkChangeStatus("to-do")}>
- {getColumnIcon("to-do")}
- To Do
- </CommandItem>
- <CommandItem onSelect={() => handleBulkChangeStatus("in-progress")}>
- {getColumnIcon("in-progress")}
- In Progress
- </CommandItem>
- <CommandItem onSelect={() => handleBulkChangeStatus("in-review")}>
- {getColumnIcon("in-review")}
- In Review
- </CommandItem>
- <CommandItem onSelect={() => handleBulkChangeStatus("done")}>
- {getColumnIcon("done")}
- Done
- </CommandItem>
+ {(project?.columns ?? []).map((col) => (
+ <CommandItem
+ key={col.id}
+ onSelect={() => handleBulkChangeStatus(col.id)}
+ >
+ {getColumnIcon(col.id)}
+ {col.name}
+ </CommandItem>
+ ))}
</CommandGroup>
<CommandGroup heading="Assign to">
diff --git a/apps/web/src/components/kanban-board/column/column-header.tsx b/apps/web/src/components/kanban-board/column/column-header.tsx
index e0c4b8a29..eee914132 100644
--- a/apps/web/src/components/kanban-board/column/column-header.tsx
+++ b/apps/web/src/components/kanban-board/column/column-header.tsx
@@ -15,7 +15,7 @@ export function ColumnHeader({ column }: ColumnHeaderProps) {
const { mutate: updateTask } = useUpdateTask();
const handleArchiveTasks = () => {
- if (column.id !== "done") return;
+ if (!column.isFinal) return;
if (column.tasks.length === 0) {
toast.info("No tasks to archive");
@@ -27,7 +27,7 @@ export function ColumnHeader({ column }: ColumnHeaderProps) {
}
const updatedProject = produce(project, (draft) => {
- const doneColumn = draft?.columns?.find((col) => col.id === "done");
+ const doneColumn = draft?.columns?.find((col) => col.isFinal);
if (!doneColumn) return;
for (const task of doneColumn.tasks) {
@@ -56,7 +56,7 @@ export function ColumnHeader({ column }: ColumnHeaderProps) {
</span>
</div>
- {column.id === "done" && column.tasks.length > 0 && (
+ {column.isFinal && column.tasks.length > 0 && (
<button
type="button"
onClick={handleArchiveTasks}
diff --git a/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx b/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
index 63cfaa468..a641470c0 100644
--- a/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
+++ b/apps/web/src/components/kanban-board/task-card-context-menu/task-card-context-menu-content.tsx
@@ -23,6 +23,7 @@ import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-
import { getColumnIcon } from "@/lib/column";
import { generateLink } from "@/lib/generate-link";
import { getPriorityIcon } from "@/lib/priority";
+import useProjectStore from "@/store/project";
import type Task from "@/types/task";
type TaskCardContext = {
@@ -41,6 +42,7 @@ export default function TaskCardContextMenuContent({
taskCardContext,
onDeleteClick,
}: TaskCardContextMenuContentProps) {
+ const { project } = useProjectStore();
const { data: workspaceUsers } = useGetActiveWorkspaceUsers(
taskCardContext.worskpaceId,
);
@@ -146,15 +148,15 @@ export default function TaskCardContextMenuContent({
<span>Status</span>
</ContextMenuSubTrigger>
<ContextMenuSubContent className="w-48">
- {["to-do", "in-progress", "in-review", "done"].map((status) => (
+ {(project?.columns ?? []).map((col) => (
<ContextMenuCheckboxItem
- key={status}
- checked={task.status === status}
- onCheckedChange={() => handleChange("status", status)}
+ key={col.id}
+ checked={task.status === col.id}
+ onCheckedChange={() => handleChange("status", col.id)}
className="[&_svg]:text-muted-foreground"
>
- {getColumnIcon(status)}
- <span className="capitalize">{status}</span>
+ {getColumnIcon(col.id)}
+ <span>{col.name}</span>
</ContextMenuCheckboxItem>
))}
</ContextMenuSubContent>
diff --git a/apps/web/src/components/list-view/index.tsx b/apps/web/src/components/list-view/index.tsx
index 628012f33..615694048 100644
--- a/apps/web/src/components/list-view/index.tsx
+++ b/apps/web/src/components/list-view/index.tsx
@@ -55,11 +55,14 @@ function ListView({ project }: ListViewProps) {
const [overColumnId, setOverColumnId] = useState<string | null>(null);
const [expandedSections, setExpandedSections] = useState<
Record<string, boolean>
- >({
- "to-do": true,
- "in-progress": true,
- "in-review": true,
- done: true,
+ >(() => {
+ const sections: Record<string, boolean> = {};
+ if (project?.columns) {
+ for (const col of project.columns) {
+ sections[col.id] = true;
+ }
+ }
+ return sections;
});
const [isTaskModalOpen, setIsTaskModalOpen] = useState(false);
const [activeColumn, setActiveColumn] = useState<string | null>(null);
@@ -220,24 +223,24 @@ function ListView({ project }: ListViewProps) {
};
const handleArchiveTasks = (column: ProjectWithTasks["columns"][number]) => {
- if (column.id !== "done" || column.tasks.length === 0) return;
+ if (!column.isFinal || column.tasks.length === 0) return;
if (!confirm(`Archive all ${column.tasks.length} completed tasks?`)) {
return;
}
const updatedProject = produce(project, (draft) => {
- const doneColumn = draft?.columns?.find((col) => col.id === "done");
- if (!doneColumn) return;
+ const finalColumn = draft?.columns?.find((col) => col.isFinal);
+ if (!finalColumn) return;
- for (const task of doneColumn.tasks) {
+ for (const task of finalColumn.tasks) {
updateTask({
...task,
status: "archived",
});
}
- doneColumn.tasks = [];
+ finalColumn.tasks = [];
});
setProject(updatedProject);
@@ -303,7 +306,7 @@ function ListView({ project }: ListViewProps) {
<Plus className="w-3 h-3" />
</button>
- {column.id === "done" && column.tasks.length > 0 && (
+ {column.isFinal && column.tasks.length > 0 && (
<button
type="button"
onClick={() => handleArchiveTasks(column)}
diff --git a/apps/web/src/components/project/column-editor.tsx b/apps/web/src/components/project/column-editor.tsx
new file mode 100644
index 000000000..7053a849b
--- /dev/null
+++ b/apps/web/src/components/project/column-editor.tsx
@@ -0,0 +1,188 @@
+import { CheckCircle2, Circle, GripVertical, Plus, Trash2 } from "lucide-react";
+import { useState } from "react";
+import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Switch } from "@/components/ui/switch";
+import { useCreateColumn } from "@/hooks/mutations/column/use-create-column";
+import { useDeleteColumn } from "@/hooks/mutations/column/use-delete-column";
+import { useReorderColumns } from "@/hooks/mutations/column/use-reorder-columns";
+import { useUpdateColumn } from "@/hooks/mutations/column/use-update-column";
+import { useGetColumns } from "@/hooks/queries/column/use-get-columns";
+
+type ColumnEditorProps = {
+ projectId: string;
+};
+
+export default function ColumnEditor({ projectId }: ColumnEditorProps) {
+ const { data: columns, isLoading } = useGetColumns(projectId);
+ const { mutateAsync: createColumn } = useCreateColumn();
+ const { mutateAsync: updateColumn } = useUpdateColumn();
+ const { mutateAsync: deleteColumn } = useDeleteColumn();
+ const { mutateAsync: reorderColumns } = useReorderColumns();
+ const [newColumnName, setNewColumnName] = useState("");
+ const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
+
+ const handleCreate = async () => {
+ if (!newColumnName.trim()) return;
+ try {
+ await createColumn({
+ projectId,
+ data: { name: newColumnName.trim() },
+ });
+ setNewColumnName("");
+ toast.success("Column created");
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to create column",
+ );
+ }
+ };
+
+ const handleRename = async (id: string, name: string) => {
+ try {
+ await updateColumn({ id, projectId, data: { name } });
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to update column",
+ );
+ }
+ };
+
+ const handleToggleFinal = async (id: string, isFinal: boolean) => {
+ try {
+ await updateColumn({ id, projectId, data: { isFinal } });
+ toast.success(
+ isFinal ? "Column marked as final" : "Column unmarked as final",
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to update column",
+ );
+ }
+ };
+
+ const handleDelete = async (id: string) => {
+ try {
+ await deleteColumn({ id, projectId });
+ toast.success("Column deleted");
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to delete column",
+ );
+ }
+ };
+
+ const handleDragStart = (index: number) => {
+ setDraggedIndex(index);
+ };
+
+ const handleDragOver = (e: React.DragEvent, index: number) => {
+ e.preventDefault();
+ if (draggedIndex === null || draggedIndex === index || !columns) return;
+
+ const reordered = [...columns];
+ const [removed] = reordered.splice(draggedIndex, 1);
+ reordered.splice(index, 0, removed);
+
+ const updates = reordered.map((col, i) => ({ id: col.id, position: i }));
+ reorderColumns({ projectId, columns: updates });
+ setDraggedIndex(index);
+ };
+
+ const handleDragEnd = () => {
+ setDraggedIndex(null);
+ };
+
+ if (isLoading) {
+ return (
+ <div className="text-sm text-muted-foreground">Loading columns...</div>
+ );
+ }
+
+ return (
+ <div className="space-y-3">
+ <div className="space-y-1">
+ {columns?.map((col, index) => (
+ // biome-ignore lint/a11y/useSemanticElements: false positive for role="listitem"
+ <div
+ key={col.id}
+ role="listitem"
+ draggable
+ onDragStart={() => handleDragStart(index)}
+ onDragOver={(e) => handleDragOver(e, index)}
+ onDragEnd={handleDragEnd}
+ className="flex items-center gap-2 p-2 border border-border rounded-md bg-sidebar hover:bg-sidebar-accent/50 transition-colors"
+ >
+ <GripVertical className="w-4 h-4 text-muted-foreground cursor-grab shrink-0" />
+ <Input
+ defaultValue={col.name}
+ className="h-8 text-sm flex-1"
+ onBlur={(e) => {
+ if (e.target.value !== col.name) {
+ handleRename(col.id, e.target.value);
+ }
+ }}
+ />
+ <div className="flex items-center gap-1.5 shrink-0">
+ <div
+ className="flex items-center gap-2"
+ title="Treat this as a done column"
+ >
+ {col.isFinal ? (
+ <CheckCircle2 className="w-3.5 h-3.5 text-muted-foreground" />
+ ) : (
+ <Circle className="w-3.5 h-3.5 text-muted-foreground" />
+ )}
+ <span className="text-xs text-muted-foreground whitespace-nowrap">
+ Done column
+ </span>
+ <Switch
+ checked={col.isFinal}
+ onCheckedChange={(checked) =>
+ handleToggleFinal(col.id, checked)
+ }
+ aria-label={`Mark ${col.name} as done column`}
+ className="scale-75"
+ />
+ <span className="text-[11px] text-muted-foreground w-8">
+ {col.isFinal ? "On" : "Off"}
+ </span>
+ </div>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="h-7 w-7 p-0 text-muted-foreground hover:text-destructive"
+ onClick={() => handleDelete(col.id)}
+ >
+ <Trash2 className="w-3.5 h-3.5" />
+ </Button>
+ </div>
+ </div>
+ ))}
+ </div>
+
+ <div className="flex items-center gap-2">
+ <Input
+ placeholder="New column name..."
+ value={newColumnName}
+ onChange={(e) => setNewColumnName(e.target.value)}
+ className="h-8 text-sm flex-1"
+ onKeyDown={(e) => {
+ if (e.key === "Enter") handleCreate();
+ }}
+ />
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleCreate}
+ disabled={!newColumnName.trim()}
+ className="h-8 gap-1"
+ >
+ <Plus className="w-3.5 h-3.5" />
+ Add
+ </Button>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/project/workflow-editor.tsx b/apps/web/src/components/project/workflow-editor.tsx
new file mode 100644
index 000000000..8a787c616
--- /dev/null
+++ b/apps/web/src/components/project/workflow-editor.tsx
@@ -0,0 +1,105 @@
+import { toast } from "sonner";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { useUpsertWorkflowRule } from "@/hooks/mutations/workflow-rule/use-upsert-workflow-rule";
+import { useGetColumns } from "@/hooks/queries/column/use-get-columns";
+import { useGetWorkflowRules } from "@/hooks/queries/workflow-rule/use-get-workflow-rules";
+
+const GITHUB_EVENTS = [
+ { eventType: "branch_push", label: "Branch Push" },
+ { eventType: "pr_opened", label: "PR Opened" },
+ { eventType: "pr_merged", label: "PR Merged" },
+ { eventType: "issue_opened", label: "Issue Opened" },
+ { eventType: "issue_closed", label: "Issue Closed" },
+];
+
+type WorkflowEditorProps = {
+ projectId: string;
+};
+
+export default function WorkflowEditor({ projectId }: WorkflowEditorProps) {
+ const { data: columns, isLoading: columnsLoading } = useGetColumns(projectId);
+ const { data: rules, isLoading: rulesLoading } =
+ useGetWorkflowRules(projectId);
+ const { mutateAsync: upsertRule } = useUpsertWorkflowRule();
+
+ const handleChange = async (eventType: string, columnId: string) => {
+ try {
+ await upsertRule({
+ projectId,
+ data: {
+ integrationType: "github",
+ eventType,
+ columnId,
+ },
+ });
+ toast.success("Workflow rule updated");
+ } catch (error) {
+ toast.error(
+ error instanceof Error ? error.message : "Failed to update rule",
+ );
+ }
+ };
+
+ if (columnsLoading || rulesLoading) {
+ return <div className="text-sm text-muted-foreground">Loading...</div>;
+ }
+
+ if (!columns || columns.length === 0) {
+ return (
+ <div className="text-sm text-muted-foreground">
+ Create columns first to configure automation rules.
+ </div>
+ );
+ }
+
+ const githubRules = rules?.filter((r) => r.integrationType === "github");
+
+ return (
+ <div className="space-y-4">
+ <div className="space-y-1">
+ <h3 className="text-sm font-medium">GitHub</h3>
+ <p className="text-xs text-muted-foreground">
+ When a GitHub event occurs, move the linked task to a column.
+ </p>
+ </div>
+
+ <div className="space-y-2">
+ {GITHUB_EVENTS.map((event) => {
+ const currentRule = githubRules?.find(
+ (r) => r.eventType === event.eventType,
+ );
+
+ return (
+ <div
+ key={event.eventType}
+ className="flex items-center justify-between gap-4 p-3 border border-border rounded-md bg-sidebar"
+ >
+ <span className="text-sm">{event.label}</span>
+ <Select
+ value={currentRule?.columnId ?? ""}
+ onValueChange={(value) => handleChange(event.eventType, value)}
+ >
+ <SelectTrigger className="w-48 h-8 text-sm">
+ <SelectValue placeholder="Select column..." />
+ </SelectTrigger>
+ <SelectContent>
+ {columns.map((col) => (
+ <SelectItem key={col.id} value={col.id}>
+ {col.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/task/task-status-popover.tsx b/apps/web/src/components/task/task-status-popover.tsx
index 45abab0e9..38d1ecf5e 100644
--- a/apps/web/src/components/task/task-status-popover.tsx
+++ b/apps/web/src/components/task/task-status-popover.tsx
@@ -11,6 +11,7 @@ import { ShortcutNumber } from "@/components/ui/shortcut-number";
import { useUpdateTaskStatus } from "@/hooks/mutations/task/use-update-task-status";
import { useNumberedShortcuts } from "@/hooks/use-numbered-shortcuts";
import { getColumnIcon } from "@/lib/column";
+import useProjectStore from "@/store/project";
import type Task from "@/types/task";
type TaskStatusPopoverProps = {
@@ -18,18 +19,17 @@ type TaskStatusPopoverProps = {
children: React.ReactNode;
};
-const statusOptions = [
- { value: "to-do", label: "To Do" },
- { value: "in-progress", label: "In Progress" },
- { value: "in-review", label: "In Review" },
- { value: "done", label: "Done" },
-];
-
export default function TaskStatusPopover({
task,
children,
}: TaskStatusPopoverProps) {
const [open, setOpen] = useState(false);
+ const { project } = useProjectStore();
+ const statusOptions =
+ project?.columns?.map((col) => ({
+ value: col.id,
+ label: col.name,
+ })) ?? [];
const { mutateAsync: updateTaskStatus } = useUpdateTaskStatus();
const handleStatusChange = useCallback(
@@ -56,7 +56,7 @@ export default function TaskStatusPopover({
statusOptions.map((status) => ({
onSelect: () => handleStatusChange(status.value),
})),
- [handleStatusChange],
+ [handleStatusChange, statusOptions],
);
useNumberedShortcuts(open, shortcutOptions);
diff --git a/apps/web/src/fetchers/column/create-column.ts b/apps/web/src/fetchers/column/create-column.ts
new file mode 100644
index 000000000..e8d2458ec
--- /dev/null
+++ b/apps/web/src/fetchers/column/create-column.ts
@@ -0,0 +1,20 @@
+import { client } from "@kaneo/libs";
+
+async function createColumn(
+ projectId: string,
+ data: { name: string; icon?: string; color?: string; isFinal?: boolean },
+) {
+ const response = await client.column[":projectId"].$post({
+ param: { projectId },
+ json: data,
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default createColumn;
diff --git a/apps/web/src/fetchers/column/delete-column.ts b/apps/web/src/fetchers/column/delete-column.ts
new file mode 100644
index 000000000..ae683a01b
--- /dev/null
+++ b/apps/web/src/fetchers/column/delete-column.ts
@@ -0,0 +1,16 @@
+import { client } from "@kaneo/libs";
+
+async function deleteColumn(id: string) {
+ const response = await client.column[":id"].$delete({
+ param: { id },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default deleteColumn;
diff --git a/apps/web/src/fetchers/column/get-columns.ts b/apps/web/src/fetchers/column/get-columns.ts
new file mode 100644
index 000000000..1b878759d
--- /dev/null
+++ b/apps/web/src/fetchers/column/get-columns.ts
@@ -0,0 +1,16 @@
+import { client } from "@kaneo/libs";
+
+async function getColumns(projectId: string) {
+ const response = await client.column[":projectId"].$get({
+ param: { projectId },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default getColumns;
diff --git a/apps/web/src/fetchers/column/reorder-columns.ts b/apps/web/src/fetchers/column/reorder-columns.ts
new file mode 100644
index 000000000..ab35a7252
--- /dev/null
+++ b/apps/web/src/fetchers/column/reorder-columns.ts
@@ -0,0 +1,20 @@
+import { client } from "@kaneo/libs";
+
+async function reorderColumns(
+ projectId: string,
+ columns: Array<{ id: string; position: number }>,
+) {
+ const response = await client.column.reorder[":projectId"].$put({
+ param: { projectId },
+ json: { columns },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default reorderColumns;
diff --git a/apps/web/src/fetchers/column/update-column.ts b/apps/web/src/fetchers/column/update-column.ts
new file mode 100644
index 000000000..64f699710
--- /dev/null
+++ b/apps/web/src/fetchers/column/update-column.ts
@@ -0,0 +1,25 @@
+import { client } from "@kaneo/libs";
+
+async function updateColumn(
+ id: string,
+ data: {
+ name?: string;
+ icon?: string | null;
+ color?: string | null;
+ isFinal?: boolean;
+ },
+) {
+ const response = await client.column[":id"].$put({
+ param: { id },
+ json: data,
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default updateColumn;
diff --git a/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts b/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts
new file mode 100644
index 000000000..08301c414
--- /dev/null
+++ b/apps/web/src/fetchers/workflow-rule/delete-workflow-rule.ts
@@ -0,0 +1,16 @@
+import { client } from "@kaneo/libs";
+
+async function deleteWorkflowRule(id: string) {
+ const response = await client["workflow-rule"][":id"].$delete({
+ param: { id },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default deleteWorkflowRule;
diff --git a/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts b/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts
new file mode 100644
index 000000000..87bbfd07f
--- /dev/null
+++ b/apps/web/src/fetchers/workflow-rule/get-workflow-rules.ts
@@ -0,0 +1,16 @@
+import { client } from "@kaneo/libs";
+
+async function getWorkflowRules(projectId: string) {
+ const response = await client["workflow-rule"][":projectId"].$get({
+ param: { projectId },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default getWorkflowRules;
diff --git a/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts b/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts
new file mode 100644
index 000000000..c17560a82
--- /dev/null
+++ b/apps/web/src/fetchers/workflow-rule/upsert-workflow-rule.ts
@@ -0,0 +1,20 @@
+import { client } from "@kaneo/libs";
+
+async function upsertWorkflowRule(
+ projectId: string,
+ data: { integrationType: string; eventType: string; columnId: string },
+) {
+ const response = await client["workflow-rule"][":projectId"].$put({
+ param: { projectId },
+ json: data,
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default upsertWorkflowRule;
diff --git a/apps/web/src/hooks/mutations/column/use-create-column.ts b/apps/web/src/hooks/mutations/column/use-create-column.ts
new file mode 100644
index 000000000..0cb4ef2c9
--- /dev/null
+++ b/apps/web/src/hooks/mutations/column/use-create-column.ts
@@ -0,0 +1,24 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import createColumn from "@/fetchers/column/create-column";
+
+export function useCreateColumn() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ data,
+ }: {
+ projectId: string;
+ data: { name: string; icon?: string; color?: string; isFinal?: boolean };
+ }) => createColumn(projectId, data),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["columns", variables.projectId],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["tasks"],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/mutations/column/use-delete-column.ts b/apps/web/src/hooks/mutations/column/use-delete-column.ts
new file mode 100644
index 000000000..e4bfe3b33
--- /dev/null
+++ b/apps/web/src/hooks/mutations/column/use-delete-column.ts
@@ -0,0 +1,18 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import deleteColumn from "@/fetchers/column/delete-column";
+
+export function useDeleteColumn() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({ id }: { id: string; projectId: string }) => deleteColumn(id),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["columns", variables.projectId],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["tasks"],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/mutations/column/use-reorder-columns.ts b/apps/web/src/hooks/mutations/column/use-reorder-columns.ts
new file mode 100644
index 000000000..b9e36d971
--- /dev/null
+++ b/apps/web/src/hooks/mutations/column/use-reorder-columns.ts
@@ -0,0 +1,24 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import reorderColumns from "@/fetchers/column/reorder-columns";
+
+export function useReorderColumns() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ columns,
+ }: {
+ projectId: string;
+ columns: Array<{ id: string; position: number }>;
+ }) => reorderColumns(projectId, columns),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["columns", variables.projectId],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["tasks"],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/mutations/column/use-update-column.ts b/apps/web/src/hooks/mutations/column/use-update-column.ts
new file mode 100644
index 000000000..049e82440
--- /dev/null
+++ b/apps/web/src/hooks/mutations/column/use-update-column.ts
@@ -0,0 +1,30 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import updateColumn from "@/fetchers/column/update-column";
+
+export function useUpdateColumn() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ id,
+ data,
+ }: {
+ id: string;
+ projectId: string;
+ data: {
+ name?: string;
+ icon?: string | null;
+ color?: string | null;
+ isFinal?: boolean;
+ };
+ }) => updateColumn(id, data),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["columns", variables.projectId],
+ });
+ queryClient.invalidateQueries({
+ queryKey: ["tasks"],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/mutations/workflow-rule/use-delete-workflow-rule.ts b/apps/web/src/hooks/mutations/workflow-rule/use-delete-workflow-rule.ts
new file mode 100644
index 000000000..578b2940c
--- /dev/null
+++ b/apps/web/src/hooks/mutations/workflow-rule/use-delete-workflow-rule.ts
@@ -0,0 +1,16 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import deleteWorkflowRule from "@/fetchers/workflow-rule/delete-workflow-rule";
+
+export function useDeleteWorkflowRule() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({ id }: { id: string; projectId: string }) =>
+ deleteWorkflowRule(id),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["workflow-rules", variables.projectId],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/mutations/workflow-rule/use-upsert-workflow-rule.ts b/apps/web/src/hooks/mutations/workflow-rule/use-upsert-workflow-rule.ts
new file mode 100644
index 000000000..c30956b68
--- /dev/null
+++ b/apps/web/src/hooks/mutations/workflow-rule/use-upsert-workflow-rule.ts
@@ -0,0 +1,21 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import upsertWorkflowRule from "@/fetchers/workflow-rule/upsert-workflow-rule";
+
+export function useUpsertWorkflowRule() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ projectId,
+ data,
+ }: {
+ projectId: string;
+ data: { integrationType: string; eventType: string; columnId: string };
+ }) => upsertWorkflowRule(projectId, data),
+ onSuccess: (_, variables) => {
+ queryClient.invalidateQueries({
+ queryKey: ["workflow-rules", variables.projectId],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/queries/column/use-get-columns.ts b/apps/web/src/hooks/queries/column/use-get-columns.ts
new file mode 100644
index 000000000..22924482f
--- /dev/null
+++ b/apps/web/src/hooks/queries/column/use-get-columns.ts
@@ -0,0 +1,10 @@
+import { useQuery } from "@tanstack/react-query";
+import getColumns from "@/fetchers/column/get-columns";
+
+export function useGetColumns(projectId: string) {
+ return useQuery({
+ queryKey: ["columns", projectId],
+ queryFn: () => getColumns(projectId),
+ enabled: !!projectId,
+ });
+}
diff --git a/apps/web/src/hooks/queries/workflow-rule/use-get-workflow-rules.ts b/apps/web/src/hooks/queries/workflow-rule/use-get-workflow-rules.ts
new file mode 100644
index 000000000..baace5e15
--- /dev/null
+++ b/apps/web/src/hooks/queries/workflow-rule/use-get-workflow-rules.ts
@@ -0,0 +1,10 @@
+import { useQuery } from "@tanstack/react-query";
+import getWorkflowRules from "@/fetchers/workflow-rule/get-workflow-rules";
+
+export function useGetWorkflowRules(projectId: string) {
+ return useQuery({
+ queryKey: ["workflow-rules", projectId],
+ queryFn: () => getWorkflowRules(projectId),
+ enabled: !!projectId,
+ });
+}
diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts
index cf9e3d0a6..d3526ee92 100644
--- a/apps/web/src/routeTree.gen.ts
+++ b/apps/web/src/routeTree.gen.ts
@@ -39,6 +39,7 @@ import { Route as LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRouteImpor
import { Route as LayoutAuthenticatedDashboardSettingsAccountPreferencesRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/preferences'
import { Route as LayoutAuthenticatedDashboardSettingsAccountInformationRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/information'
import { Route as LayoutAuthenticatedDashboardSettingsAccountDeveloperRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/developer'
+import { Route as LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRouteImport } from './routes/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow'
import { Route as LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRouteImport } from './routes/_layout/_authenticated/dashboard/settings/projects/$projectId/visibility'
import { Route as LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRouteImport } from './routes/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations'
import { Route as LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRouteImport } from './routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general'
@@ -215,6 +216,14 @@ const LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute =
path: '/developer',
getParentRoute: () => LayoutAuthenticatedDashboardSettingsAccountRoute,
} as any)
+const LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute =
+ LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRouteImport.update(
+ {
+ id: '/$projectId/workflow',
+ path: '/$projectId/workflow',
+ getParentRoute: () => LayoutAuthenticatedDashboardSettingsProjectsRoute,
+ } as any,
+ )
const LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute =
LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRouteImport.update(
{
@@ -308,6 +317,7 @@ export interface FileRoutesByFullPath {
'/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
'/dashboard/settings/projects/$projectId/integrations': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute
'/dashboard/settings/projects/$projectId/visibility': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute
+ '/dashboard/settings/projects/$projectId/workflow': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/dashboard/workspace/$workspaceId/project/$projectId/board': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/dashboard/workspace/$workspaceId/project/$projectId/': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
@@ -343,6 +353,7 @@ export interface FileRoutesByTo {
'/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
'/dashboard/settings/projects/$projectId/integrations': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute
'/dashboard/settings/projects/$projectId/visibility': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute
+ '/dashboard/settings/projects/$projectId/workflow': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute
'/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/dashboard/workspace/$workspaceId/project/$projectId/board': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/dashboard/workspace/$workspaceId/project/$projectId': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
@@ -383,6 +394,7 @@ export interface FileRoutesById {
'/_layout/_authenticated/dashboard/settings/projects/$projectId/general': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
'/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute
'/_layout/_authenticated/dashboard/settings/projects/$projectId/visibility': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute
+ '/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow': typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBacklogRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdBoardRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdProjectProjectIdIndexRoute
@@ -422,6 +434,7 @@ export interface FileRouteTypes {
| '/dashboard/settings/projects/$projectId/general'
| '/dashboard/settings/projects/$projectId/integrations'
| '/dashboard/settings/projects/$projectId/visibility'
+ | '/dashboard/settings/projects/$projectId/workflow'
| '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/dashboard/workspace/$workspaceId/project/$projectId/'
@@ -457,6 +470,7 @@ export interface FileRouteTypes {
| '/dashboard/settings/projects/$projectId/general'
| '/dashboard/settings/projects/$projectId/integrations'
| '/dashboard/settings/projects/$projectId/visibility'
+ | '/dashboard/settings/projects/$projectId/workflow'
| '/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/dashboard/workspace/$workspaceId/project/$projectId'
@@ -496,6 +510,7 @@ export interface FileRouteTypes {
| '/_layout/_authenticated/dashboard/settings/projects/$projectId/general'
| '/_layout/_authenticated/dashboard/settings/projects/$projectId/integrations'
| '/_layout/_authenticated/dashboard/settings/projects/$projectId/visibility'
+ | '/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/backlog'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/board'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/'
@@ -723,6 +738,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsAccountDeveloperRouteImport
parentRoute: typeof LayoutAuthenticatedDashboardSettingsAccountRoute
}
+ '/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow': {
+ id: '/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow'
+ path: '/$projectId/workflow'
+ fullPath: '/dashboard/settings/projects/$projectId/workflow'
+ preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRouteImport
+ parentRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsRoute
+ }
'/_layout/_authenticated/dashboard/settings/projects/$projectId/visibility': {
id: '/_layout/_authenticated/dashboard/settings/projects/$projectId/visibility'
path: '/$projectId/visibility'
@@ -800,6 +822,7 @@ interface LayoutAuthenticatedDashboardSettingsProjectsRouteChildren {
LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdGeneralRoute
LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute
LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute
+ LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute: typeof LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute
}
const LayoutAuthenticatedDashboardSettingsProjectsRouteChildren: LayoutAuthenticatedDashboardSettingsProjectsRouteChildren =
@@ -810,6 +833,8 @@ const LayoutAuthenticatedDashboardSettingsProjectsRouteChildren: LayoutAuthentic
LayoutAuthenticatedDashboardSettingsProjectsProjectIdIntegrationsRoute,
LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute:
LayoutAuthenticatedDashboardSettingsProjectsProjectIdVisibilityRoute,
+ LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute:
+ LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRoute,
}
const LayoutAuthenticatedDashboardSettingsProjectsRouteWithChildren =
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx
index 253882791..f03aef190 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx
@@ -3,8 +3,10 @@ import {
Link,
Outlet,
useLocation,
+ useNavigate,
} from "@tanstack/react-router";
-import { ChevronRight, Eye, Plug, Settings } from "lucide-react";
+import { ChevronRight, Eye, GitBranch, Plug, Settings } from "lucide-react";
+import { useEffect } from "react";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import {
Collapsible,
@@ -35,15 +37,36 @@ const menuItems = [
title: "Integrations",
icon: Plug,
},
+ {
+ title: "Workflow",
+ icon: GitBranch,
+ },
];
function RouteComponent() {
const { workspace, role } = useWorkspacePermission();
const location = useLocation();
+ const navigate = useNavigate();
const { data: projects } = useGetProjects({
workspaceId: workspace?.id || "",
});
+ useEffect(() => {
+ const isProjectsRoot =
+ location.pathname === "/dashboard/settings/projects" ||
+ location.pathname === "/dashboard/settings/projects/";
+
+ if (!isProjectsRoot || !projects || projects.length === 0) {
+ return;
+ }
+
+ void navigate({
+ to: "/dashboard/settings/projects/$projectId/general",
+ params: { projectId: projects[0].id },
+ replace: true,
+ });
+ }, [location.pathname, navigate, projects]);
+
return (
<div className="flex gap-6 h-full">
<div className="w-64 flex-shrink-0">
@@ -95,6 +118,7 @@ function RouteComponent() {
General: `/dashboard/settings/projects/${project.id}/general`,
Visibility: `/dashboard/settings/projects/${project.id}/visibility`,
Integrations: `/dashboard/settings/projects/${project.id}/integrations`,
+ Workflow: `/dashboard/settings/projects/${project.id}/workflow`,
};
const toUrl =
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow.tsx
new file mode 100644
index 000000000..5071fb51b
--- /dev/null
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow.tsx
@@ -0,0 +1,50 @@
+import { createFileRoute } from "@tanstack/react-router";
+import PageTitle from "@/components/page-title";
+import ColumnEditor from "@/components/project/column-editor";
+import WorkflowEditor from "@/components/project/workflow-editor";
+
+export const Route = createFileRoute(
+ "/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow",
+)({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const { projectId } = Route.useParams();
+
+ return (
+ <>
+ <PageTitle title="Workflow Settings" />
+ <div className="max-w-4xl mx-auto space-y-8">
+ <div className="space-y-2">
+ <h1 className="text-2xl font-semibold">Workflow</h1>
+ <p className="text-muted-foreground">
+ Configure board columns and automation rules for this project.
+ </p>
+ </div>
+
+ <div className="space-y-6">
+ <div className="space-y-1">
+ <h2 className="text-md font-medium">Columns</h2>
+ <p className="text-xs text-muted-foreground">
+ Manage the columns that appear on your board. Drag to reorder.
+ Turn on "Done column" for stages that represent completed work.
+ </p>
+ </div>
+ <ColumnEditor projectId={projectId} />
+ </div>
+
+ <div className="space-y-6">
+ <div className="space-y-1">
+ <h2 className="text-md font-medium">Automation Rules</h2>
+ <p className="text-xs text-muted-foreground">
+ Map integration events to columns. When an event occurs, the
+ linked task moves to the specified column.
+ </p>
+ </div>
+ <WorkflowEditor projectId={projectId} />
+ </div>
+ </div>
+ </>
+ );
+}