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: allow manual external resource links (#1661)

Mohiuddin0cd37e20b9cc
diff --git a/apps/api/drizzle/0051_modern_corsair.sql b/apps/api/drizzle/0051_modern_corsair.sql
new file mode 100644
index 000000000..36fe0b4c5
--- /dev/null
+++ b/apps/api/drizzle/0051_modern_corsair.sql
@@ -0,0 +1 @@
+ALTER TABLE "external_link" ALTER COLUMN "integration_id" DROP NOT NULL;
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0051_snapshot.json b/apps/api/drizzle/meta/0051_snapshot.json
new file mode 100644
index 000000000..f64fd1b30
--- /dev/null
+++ b/apps/api/drizzle/meta/0051_snapshot.json
@@ -0,0 +1,4504 @@
+{
+ "id": "de1aba3a-dd83-48d6-93a3-c53b2ff18aee",
+ "prevId": "f9757406-e33b-407b-9849-36c7af901b05",
+ "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()"
+ },
+ "updated_at": {
+ "name": "updated_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
+ },
+ "event_data": {
+ "name": "event_data",
+ "type": "jsonb",
+ "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": {
+ "activity_task_id_idx": {
+ "name": "activity_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "activity_userId_idx": {
+ "name": "activity_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "activity_task_external_source_external_url_unique": {
+ "name": "activity_task_external_source_external_url_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "external_source", "external_url"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "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": false
+ },
+ "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_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "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_reference_id_user_id_fk": {
+ "name": "apikey_reference_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["reference_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "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.asset": {
+ "name": "asset",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activity_id": {
+ "name": "activity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'image'"
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'description'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "asset_workspaceId_idx": {
+ "name": "asset_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_projectId_idx": {
+ "name": "asset_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_taskId_idx": {
+ "name": "asset_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_activityId_idx": {
+ "name": "asset_activityId_idx",
+ "columns": [
+ {
+ "expression": "activity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_createdBy_idx": {
+ "name": "asset_createdBy_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "asset_workspace_id_workspace_id_fk": {
+ "name": "asset_workspace_id_workspace_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_project_id_project_id_fk": {
+ "name": "asset_project_id_project_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_task_id_task_id_fk": {
+ "name": "asset_task_id_task_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_activity_id_activity_id_fk": {
+ "name": "asset_activity_id_activity_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "activity",
+ "columnsFrom": ["activity_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_created_by_user_id_fk": {
+ "name": "asset_created_by_user_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "asset_object_key_unique": {
+ "name": "asset_object_key_unique",
+ "nullsNotDistinct": false,
+ "columns": ["object_key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_event": {
+ "name": "billing_event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_reminder_sent": {
+ "name": "billing_reminder_sent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reminder_type": {
+ "name": "reminder_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trial_ends_at": {
+ "name": "trial_ends_at",
+ "type": "timestamp",
+ "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": {
+ "billing_reminder_sent_workspaceId_idx": {
+ "name": "billing_reminder_sent_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "billing_reminder_sent_userId_idx": {
+ "name": "billing_reminder_sent_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_reminder_sent_user_id_user_id_fk": {
+ "name": "billing_reminder_sent_user_id_user_id_fk",
+ "tableFrom": "billing_reminder_sent",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "billing_reminder_sent_workspace_id_workspace_id_fk": {
+ "name": "billing_reminder_sent_workspace_id_workspace_id_fk",
+ "tableFrom": "billing_reminder_sent",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "billing_reminder_sent_user_type_unique": {
+ "name": "billing_reminder_sent_user_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id", "reminder_type"]
+ }
+ },
+ "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.comment": {
+ "name": "comment",
+ "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": true
+ },
+ "content": {
+ "name": "content",
+ "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": {
+ "comment_task_idx": {
+ "name": "comment_task_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "comment_user_idx": {
+ "name": "comment_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "comment_task_id_task_id_fk": {
+ "name": "comment_task_id_task_id_fk",
+ "tableFrom": "comment",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "comment_user_id_user_id_fk": {
+ "name": "comment_user_id_user_id_fk",
+ "tableFrom": "comment",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field_definition": {
+ "name": "custom_field_definition",
+ "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
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "required": {
+ "name": "required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "default_value": {
+ "name": "default_value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "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": {
+ "custom_field_def_projectId_idx": {
+ "name": "custom_field_def_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "custom_field_definition_project_id_project_id_fk": {
+ "name": "custom_field_definition_project_id_project_id_fk",
+ "tableFrom": "custom_field_definition",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field_value": {
+ "name": "custom_field_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "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": {
+ "custom_field_value_taskId_idx": {
+ "name": "custom_field_value_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "custom_field_value_fieldId_idx": {
+ "name": "custom_field_value_fieldId_idx",
+ "columns": [
+ {
+ "expression": "field_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "custom_field_value_task_id_task_id_fk": {
+ "name": "custom_field_value_task_id_task_id_fk",
+ "tableFrom": "custom_field_value",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "custom_field_value_field_id_custom_field_definition_id_fk": {
+ "name": "custom_field_value_field_id_custom_field_definition_id_fk",
+ "tableFrom": "custom_field_value",
+ "tableTo": "custom_field_definition",
+ "columnsFrom": ["field_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_field_value_task_field_unique": {
+ "name": "custom_field_value_task_field_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "field_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.device_code": {
+ "name": "device_code",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "device_code": {
+ "name": "device_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_code": {
+ "name": "user_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "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()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_polled_at": {
+ "name": "last_polled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "polling_interval": {
+ "name": "polling_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "device_code_device_code_uidx": {
+ "name": "device_code_device_code_uidx",
+ "columns": [
+ {
+ "expression": "device_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_code_user_code_uidx": {
+ "name": "device_code_user_code_uidx",
+ "columns": [
+ {
+ "expression": "user_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_code_user_id_idx": {
+ "name": "device_code_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_code_user_id_user_id_fk": {
+ "name": "device_code_user_id_user_id_fk",
+ "tableFrom": "device_code",
+ "tableTo": "user",
+ "columnsFrom": ["user_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": false
+ },
+ "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_import": {
+ "name": "github_import",
+ "schema": "",
+ "columns": {
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_import_integration_id_integration_id_fk": {
+ "name": "github_import_integration_id_integration_id_fk",
+ "tableFrom": "github_import",
+ "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": {
+ "integration_project_type_unique": {
+ "name": "integration_project_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id", "type"]
+ }
+ },
+ "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": {}
+ },
+ "invitation_inviterId_idx": {
+ "name": "invitation_inviterId_idx",
+ "columns": [
+ {
+ "expression": "inviter_id",
+ "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.job_lease": {
+ "name": "job_lease",
+ "schema": "",
+ "columns": {
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "owner": {
+ "name": "owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "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()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deletion_started_at": {
+ "name": "deletion_started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "label_task_id_idx": {
+ "name": "label_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "label_workspace_id_idx": {
+ "name": "label_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "label_workspace_cascade_idx": {
+ "name": "label_workspace_cascade_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"label\".\"task_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "label_workspace_name_unique": {
+ "name": "label_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"label\".\"task_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": {
+ "label_task_name_unique": {
+ "name": "label_task_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "name"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mcp_oauth_state": {
+ "name": "mcp_oauth_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "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": {
+ "mcp_oauth_state_kind_key_uidx": {
+ "name": "mcp_oauth_state_kind_key_uidx",
+ "columns": [
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "mcp_oauth_state_expiresAt_idx": {
+ "name": "mcp_oauth_state_expiresAt_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "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": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "event_data": {
+ "name": "event_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_userId_idx": {
+ "name": "notification_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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.workspace_role": {
+ "name": "workspace_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "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": {
+ "workspace_role_workspaceId_idx": {
+ "name": "workspace_role_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_role_role_idx": {
+ "name": "workspace_role_role_idx",
+ "columns": [
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_role_workspace_id_workspace_id_fk": {
+ "name": "workspace_role_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_role",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_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
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_task_number": {
+ "name": "last_task_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "project_workspaceId_position_idx": {
+ "name": "project_workspaceId_position_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": {
+ "project_workspace_id_id_unique": {
+ "name": "project_workspace_id_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id", "id"]
+ }
+ },
+ "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
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "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_relation": {
+ "name": "task_relation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_task_id": {
+ "name": "source_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_task_id": {
+ "name": "target_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "relation_type": {
+ "name": "relation_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_relation_source_idx": {
+ "name": "task_relation_source_idx",
+ "columns": [
+ {
+ "expression": "source_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_relation_target_idx": {
+ "name": "task_relation_target_idx",
+ "columns": [
+ {
+ "expression": "target_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_relation_source_task_id_task_id_fk": {
+ "name": "task_relation_source_task_id_task_id_fk",
+ "tableFrom": "task_relation",
+ "tableTo": "task",
+ "columnsFrom": ["source_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_relation_target_task_id_task_id_fk": {
+ "name": "task_relation_target_task_id_task_id_fk",
+ "tableFrom": "task_relation",
+ "tableTo": "task",
+ "columnsFrom": ["target_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_reminder_sent": {
+ "name": "task_reminder_sent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reminder_type": {
+ "name": "reminder_type",
+ "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": {
+ "task_reminder_sent_taskId_idx": {
+ "name": "task_reminder_sent_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_reminder_sent_task_id_task_id_fk": {
+ "name": "task_reminder_sent_task_id_task_id_fk",
+ "tableFrom": "task_reminder_sent",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_reminder_sent_task_type_unique": {
+ "name": "task_reminder_sent_task_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "reminder_type"]
+ }
+ },
+ "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": true,
+ "default": "'low'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "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": {
+ "task_projectId_idx": {
+ "name": "task_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_dueDate_idx": {
+ "name": "task_dueDate_idx",
+ "columns": [
+ {
+ "expression": "due_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_assigneeId_idx": {
+ "name": "task_assigneeId_idx",
+ "columns": [
+ {
+ "expression": "assignee_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_columnId_idx": {
+ "name": "task_columnId_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": "set null",
+ "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": {
+ "task_project_number_unique": {
+ "name": "task_project_number_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id", "number"]
+ }
+ },
+ "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.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.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()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "time_entry_taskId_idx": {
+ "name": "time_entry_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "time_entry_userId_idx": {
+ "name": "time_entry_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "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": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.trial_grant": {
+ "name": "trial_grant",
+ "schema": "",
+ "columns": {
+ "email_hash": {
+ "name": "email_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "trial_ends_at": {
+ "name": "trial_ends_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "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
+ },
+ "locale": {
+ "name": "locale",
+ "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
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "banned": {
+ "name": "banned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "ban_reason": {
+ "name": "ban_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ban_expires": {
+ "name": "ban_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_avatar": {
+ "name": "user_avatar",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "bytea",
+ "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": {
+ "user_avatar_userId_idx": {
+ "name": "user_avatar_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_avatar_user_id_user_id_fk": {
+ "name": "user_avatar_user_id_user_id_fk",
+ "tableFrom": "user_avatar",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_avatar_user_id_unique": {
+ "name": "user_avatar_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_enabled": {
+ "name": "email_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_enabled": {
+ "name": "ntfy_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_server_url": {
+ "name": "ntfy_server_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ntfy_topic": {
+ "name": "ntfy_topic",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ntfy_token": {
+ "name": "ntfy_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gotify_enabled": {
+ "name": "gotify_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "gotify_server_url": {
+ "name": "gotify_server_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gotify_token": {
+ "name": "gotify_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_enabled": {
+ "name": "webhook_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "webhook_url": {
+ "name": "webhook_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_secret": {
+ "name": "webhook_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_assignment_enabled": {
+ "name": "task_assignment_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "task_comment_enabled": {
+ "name": "task_comment_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "task_status_change_enabled": {
+ "name": "task_status_change_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "due_date_reminder_enabled": {
+ "name": "due_date_reminder_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "due_date_reminder_lead_time_minutes": {
+ "name": "due_date_reminder_lead_time_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1440
+ },
+ "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": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_preference_user_id_unique": {
+ "name": "user_notification_preference_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_workspace_project": {
+ "name": "user_notification_workspace_project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_rule_id": {
+ "name": "workspace_rule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_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": {
+ "user_notification_workspace_project_ruleId_idx": {
+ "name": "user_notification_workspace_project_ruleId_idx",
+ "columns": [
+ {
+ "expression": "workspace_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_project_projectId_idx": {
+ "name": "user_notification_workspace_project_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_project_workspaceId_projectId_idx": {
+ "name": "user_notification_workspace_project_workspaceId_projectId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "unwp_workspaceId_workspaceRuleId_idx": {
+ "name": "unwp_workspaceId_workspaceRuleId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_notification_workspace_project_workspace_id_workspace_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_workspace_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "user_notification_workspace_rule",
+ "columnsFrom": ["workspace_id", "workspace_rule_id"],
+ "columnsTo": ["workspace_id", "id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "project",
+ "columnsFrom": ["workspace_id", "project_id"],
+ "columnsTo": ["workspace_id", "id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_workspace_project_rule_project_unique": {
+ "name": "user_notification_workspace_project_rule_project_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_rule_id", "project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_workspace_rule": {
+ "name": "user_notification_workspace_rule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "email_enabled": {
+ "name": "email_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_enabled": {
+ "name": "ntfy_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "gotify_enabled": {
+ "name": "gotify_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "webhook_enabled": {
+ "name": "webhook_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "project_mode": {
+ "name": "project_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "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": {
+ "user_notification_workspace_rule_userId_idx": {
+ "name": "user_notification_workspace_rule_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_rule_workspaceId_idx": {
+ "name": "user_notification_workspace_rule_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_notification_workspace_rule_user_id_user_id_fk": {
+ "name": "user_notification_workspace_rule_user_id_user_id_fk",
+ "tableFrom": "user_notification_workspace_rule",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_rule_workspace_id_workspace_id_fk": {
+ "name": "user_notification_workspace_rule_workspace_id_workspace_id_fk",
+ "tableFrom": "user_notification_workspace_rule",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_workspace_rule_user_workspace_unique": {
+ "name": "user_notification_workspace_rule_user_workspace_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id", "workspace_id"]
+ },
+ "user_notification_workspace_rule_workspace_id_id_unique": {
+ "name": "user_notification_workspace_rule_workspace_id_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id", "id"]
+ }
+ },
+ "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": {}
+ },
+ "workflow_rule_columnId_idx": {
+ "name": "workflow_rule_columnId_idx",
+ "columns": [
+ {
+ "expression": "column_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_billing": {
+ "name": "workspace_billing",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "founding_free": {
+ "name": "founding_free",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "trial_ends_at": {
+ "name": "trial_ends_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "creem_customer_id": {
+ "name": "creem_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "creem_subscription_id": {
+ "name": "creem_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "creem_product_id": {
+ "name": "creem_product_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "plan": {
+ "name": "plan",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_interval": {
+ "name": "billing_interval",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seats": {
+ "name": "seats",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp",
+ "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": {
+ "workspace_billing_workspaceId_idx": {
+ "name": "workspace_billing_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_billing_workspace_id_workspace_id_fk": {
+ "name": "workspace_billing_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_billing",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_billing_workspace_id_unique": {
+ "name": "workspace_billing_workspace_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id"]
+ },
+ "workspace_billing_creem_subscription_id_unique": {
+ "name": "workspace_billing_creem_subscription_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["creem_subscription_id"]
+ }
+ },
+ "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 cd6b9400b..ca4224a72 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -358,6 +358,13 @@
"when": 1789853277231,
"tag": "0050_resumable_github_import",
"breakpoints": true
+ },
+ {
+ "idx": 51,
+ "version": "7",
+ "when": 1790370789562,
+ "tag": "0051_modern_corsair",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 5c937e085..c5ae1901e 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -926,12 +926,13 @@ export const externalLinkTable = pgTable(
onDelete: "cascade",
onUpdate: "cascade",
}),
- integrationId: text("integration_id")
- .notNull()
- .references(() => integrationTable.id, {
+ integrationId: text("integration_id").references(
+ () => integrationTable.id,
+ {
onDelete: "cascade",
onUpdate: "cascade",
- }),
+ },
+ ),
resourceType: text("resource_type").notNull(),
externalId: text("external_id").notNull(),
url: text("url").notNull(),
diff --git a/apps/api/src/external-link/controllers/create-external-link.ts b/apps/api/src/external-link/controllers/create-external-link.ts
new file mode 100644
index 000000000..1e6242e0b
--- /dev/null
+++ b/apps/api/src/external-link/controllers/create-external-link.ts
@@ -0,0 +1,68 @@
+import { eq } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import {
+ externalLinkTable,
+ projectTable,
+ taskTable,
+} from "../../database/schema";
+import { publishEvent } from "../../events";
+
+async function createExternalLink({
+ taskId,
+ url,
+ title,
+ userId,
+}: {
+ taskId: string;
+ url: string;
+ title?: string;
+ userId: string;
+}) {
+ const [link] = await db
+ .insert(externalLinkTable)
+ .values({
+ taskId,
+ integrationId: null,
+ resourceType: "url",
+ externalId: url,
+ url,
+ title: title ?? null,
+ })
+ .returning();
+
+ if (!link) {
+ throw new HTTPException(500, {
+ message: "Failed to create external link",
+ });
+ }
+
+ const [task] = await db
+ .select({
+ projectId: taskTable.projectId,
+ title: taskTable.title,
+ status: taskTable.status,
+ })
+ .from(taskTable)
+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
+ .where(eq(taskTable.id, taskId))
+ .limit(1);
+
+ if (!task) {
+ throw new HTTPException(404, {
+ message: "Task not found",
+ });
+ }
+
+ await publishEvent("task.updated", {
+ taskId,
+ projectId: task.projectId,
+ title: task.title,
+ status: task.status,
+ userId,
+ });
+
+ return link;
+}
+
+export default createExternalLink;
diff --git a/apps/api/src/external-link/controllers/delete-external-link.ts b/apps/api/src/external-link/controllers/delete-external-link.ts
new file mode 100644
index 000000000..b3667b431
--- /dev/null
+++ b/apps/api/src/external-link/controllers/delete-external-link.ts
@@ -0,0 +1,39 @@
+import { and, eq, isNull } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../../database";
+import { externalLinkTable, taskTable } from "../../database/schema";
+import { publishEvent } from "../../events";
+
+export default async function deleteExternalLink({
+ taskId,
+ id,
+ userId,
+}: {
+ taskId: string;
+ id: string;
+ userId: string;
+}) {
+ const task = await db.query.taskTable.findFirst({
+ where: eq(taskTable.id, taskId),
+ columns: { projectId: true, title: true, status: true },
+ });
+ if (!task) throw new HTTPException(404, { message: "Task not found" });
+
+ // Bind deletion to the authorized task and leave provider-managed links intact.
+ const [deleted] = await db
+ .delete(externalLinkTable)
+ .where(
+ and(
+ eq(externalLinkTable.id, id),
+ eq(externalLinkTable.taskId, taskId),
+ isNull(externalLinkTable.integrationId),
+ eq(externalLinkTable.resourceType, "url"),
+ ),
+ )
+ .returning({ id: externalLinkTable.id });
+ if (!deleted)
+ throw new HTTPException(404, { message: "Manual resource link not found" });
+
+ await publishEvent("task.updated", { taskId, ...task, userId });
+ return deleted;
+}
diff --git a/apps/api/src/external-link/index.ts b/apps/api/src/external-link/index.ts
index 8db5b1597..6e81b3ae9 100644
--- a/apps/api/src/external-link/index.ts
+++ b/apps/api/src/external-link/index.ts
@@ -8,9 +8,75 @@ import {
errorResponse,
jsonResponse,
} from "../openapi";
+import { requireWorkspacePermission } from "../utils/require-workspace-permission";
import { workspaceAccess } from "../utils/workspace-access-middleware";
-import { externalLinkListSchema } from "./response";
-import { taskIdParam } from "./schema";
+import createExternalLink from "./controllers/create-external-link";
+import deleteExternalLink from "./controllers/delete-external-link";
+import {
+ createdExternalLinkSchema,
+ deletedExternalLinkSchema,
+ externalLinkListSchema,
+} from "./response";
+import {
+ createExternalLinkBody,
+ deleteExternalLinkParam,
+ taskIdParam,
+} from "./schema";
+
+const createExternalLinkRoute = createRoute({
+ method: "post",
+ operationId: "createExternalLink",
+ path: "/task/{taskId}",
+ tags: ["External Links"],
+ summary: "Create an external link",
+ description: "Add a resource link to a task",
+ middleware: [
+ workspaceAccess.fromTaskId("taskId"),
+ requireWorkspacePermission({ task: ["update"] }),
+ ] as const,
+ request: {
+ params: taskIdParam,
+ body: {
+ required: true,
+ content: {
+ "application/json": {
+ schema: createExternalLinkBody,
+ },
+ },
+ },
+ },
+ responses: {
+ 200: jsonResponse(
+ "External link created successfully",
+ createdExternalLinkSchema,
+ ),
+ 400: errorResponse("Invalid external link data"),
+ 401: errorResponse("Unauthorized"),
+ 403: errorResponse("No permission to update the task"),
+ },
+});
+
+const deleteExternalLinkRoute = createRoute({
+ method: "delete",
+ operationId: "deleteExternalLink",
+ path: "/task/{taskId}/{id}",
+ tags: ["External Links"],
+ summary: "Remove a manual resource link",
+ description:
+ "Remove a manually added link from a task. Integration-managed links cannot be removed through this endpoint.",
+ middleware: [
+ workspaceAccess.fromTaskId("taskId"),
+ requireWorkspacePermission({ task: ["update"] }),
+ ] as const,
+ request: { params: deleteExternalLinkParam },
+ responses: {
+ 200: jsonResponse("Resource link removed", deletedExternalLinkSchema),
+ 400: errorResponse("Unknown task or invalid link data"),
+ 401: errorResponse("Unauthorized"),
+ 403: errorResponse("No permission to update the task"),
+ 404: errorResponse("Manual resource link not found on this task"),
+ },
+});
const getExternalLinksByTaskRoute = createRoute({
method: "get",
@@ -19,7 +85,7 @@ const getExternalLinksByTaskRoute = createRoute({
tags: ["External Links"],
summary: "Get task external links",
description:
- "Get all links from a task to resources in connected integrations, such as GitHub or Gitea issues.",
+ "Get manually added resource links and links from connected integrations, such as GitHub or Gitea issues.",
middleware: [workspaceAccess.fromTaskId("taskId")] as const,
request: { params: taskIdParam },
responses: {
@@ -31,27 +97,52 @@ const getExternalLinksByTaskRoute = createRoute({
},
});
-const externalLink = apiRouter<
- BaseVariables & { workspaceId: string }
->().openapi(getExternalLinksByTaskRoute, async (c) => {
- const { taskId } = c.req.valid("param");
-
- const links = await db.query.externalLinkTable.findMany({
- where: eq(externalLinkTable.taskId, taskId),
- with: {
- // Never widen this: integration.config holds plaintext provider
- // secrets and this route is reachable by any workspace member.
- integration: { columns: { id: true, type: true } },
- },
- });
+const externalLink = apiRouter<BaseVariables & { workspaceId: string }>()
+ .openapi(createExternalLinkRoute, async (c) => {
+ const { taskId } = c.req.valid("param");
+ const { url, title } = c.req.valid("json");
- return c.json(
- links.map((link) => ({
- ...link,
- metadata: link.metadata ? JSON.parse(link.metadata) : null,
- })),
- 200,
- );
-});
+ const link = await createExternalLink({
+ taskId,
+ url,
+ title,
+ userId: c.get("userId"),
+ });
+
+ return c.json(
+ {
+ ...link,
+ metadata: link.metadata ? JSON.parse(link.metadata) : null,
+ },
+ 200,
+ );
+ })
+ .openapi(deleteExternalLinkRoute, async (c) => {
+ const { taskId, id } = c.req.valid("param");
+ return c.json(
+ await deleteExternalLink({ taskId, id, userId: c.get("userId") }),
+ 200,
+ );
+ })
+ .openapi(getExternalLinksByTaskRoute, async (c) => {
+ const { taskId } = c.req.valid("param");
+
+ const links = await db.query.externalLinkTable.findMany({
+ where: eq(externalLinkTable.taskId, taskId),
+ with: {
+ // Never widen this: integration.config holds plaintext provider
+ // secrets and this route is reachable by any workspace member.
+ integration: { columns: { id: true, type: true } },
+ },
+ });
+
+ return c.json(
+ links.map((link) => ({
+ ...link,
+ metadata: link.metadata ? JSON.parse(link.metadata) : null,
+ })),
+ 200,
+ );
+ });
export default externalLink;
diff --git a/apps/api/src/external-link/response.ts b/apps/api/src/external-link/response.ts
index 56613f0ca..bf66f4a8f 100644
--- a/apps/api/src/external-link/response.ts
+++ b/apps/api/src/external-link/response.ts
@@ -4,13 +4,14 @@ export const externalLinkSchema = z
.object({
id: z.string(),
taskId: z.string(),
- integrationId: z.string(),
+ integrationId: z.string().nullable(),
resourceType: z.string().openapi({
description:
- "The kind of remote resource, e.g. `issue` or `pull_request`.",
+ "The resource kind: `url` for a manual link, or an integration resource such as `issue` or `pull_request`.",
}),
externalId: z.string().openapi({
- description: "The provider's own identifier for the linked resource.",
+ description:
+ "The provider's resource identifier, or the URL for a manual link.",
}),
url: z.string(),
title: z.string().nullable(),
@@ -24,8 +25,19 @@ export const externalLinkSchema = z
// plaintext provider secrets and any workspace member can read this route.
integration: z
.object({ id: z.string(), type: z.string() })
+ .nullable()
.openapi("ExternalLinkIntegration"),
})
.openapi("ExternalLink");
+export const createdExternalLinkSchema = externalLinkSchema
+ .omit({
+ integration: true,
+ })
+ .openapi("CreatedExternalLink");
+
export const externalLinkListSchema = z.array(externalLinkSchema);
+
+export const deletedExternalLinkSchema = z
+ .object({ id: z.string() })
+ .openapi("DeletedExternalLink");
diff --git a/apps/api/src/external-link/schema.ts b/apps/api/src/external-link/schema.ts
index a7f80ace2..e42b40963 100644
--- a/apps/api/src/external-link/schema.ts
+++ b/apps/api/src/external-link/schema.ts
@@ -1,3 +1,14 @@
import { z } from "../openapi";
export const taskIdParam = z.object({ taskId: z.string() });
+
+export const createExternalLinkBody = z.object({
+ url: z
+ .string()
+ .url()
+ .refine((url) => /^https?:\/\//i.test(url), "URL must use http or https")
+ .describe("An HTTP or HTTPS URL"),
+ title: z.string().max(200).optional(),
+});
+
+export const deleteExternalLinkParam = taskIdParam.extend({ id: z.string() });
diff --git a/apps/api/src/task/controllers/get-tasks.ts b/apps/api/src/task/controllers/get-tasks.ts
index 4a876fbb3..5b796f5e4 100644
--- a/apps/api/src/task/controllers/get-tasks.ts
+++ b/apps/api/src/task/controllers/get-tasks.ts
@@ -221,7 +221,7 @@ async function getTasksPage(
Array<{
id: string;
taskId: string;
- integrationId: string;
+ integrationId: string | null;
resourceType: string;
externalId: string;
url: string;
diff --git a/apps/api/src/task/response.ts b/apps/api/src/task/response.ts
index 03f8b1d48..1688b2b4c 100644
--- a/apps/api/src/task/response.ts
+++ b/apps/api/src/task/response.ts
@@ -50,7 +50,7 @@ const taskExternalLinkSchema = z
.object({
id: z.string(),
taskId: z.string(),
- integrationId: z.string(),
+ integrationId: z.string().nullable(),
resourceType: z.string(),
externalId: z.string(),
url: z.string(),
diff --git a/apps/docs/openapi.json b/apps/docs/openapi.json
index 2919dab4d..d104d3019 100644
--- a/apps/docs/openapi.json
+++ b/apps/docs/openapi.json
@@ -244,7 +244,10 @@
"type": "string"
},
"integrationId": {
- "type": "string"
+ "type": [
+ "string",
+ "null"
+ ]
},
"resourceType": {
"type": "string"
@@ -3003,7 +3006,7 @@
"createdAt"
]
},
- "ExternalLink": {
+ "CreatedExternalLink": {
"type": "object",
"properties": {
"id": {
@@ -3013,15 +3016,85 @@
"type": "string"
},
"integrationId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "resourceType": {
+ "type": "string",
+ "description": "The resource kind: `url` for a manual link, or an integration resource such as `issue` or `pull_request`."
+ },
+ "externalId": {
+ "type": "string",
+ "description": "The provider's resource identifier, or the URL for a manual link."
+ },
+ "url": {
+ "type": "string"
+ },
+ "title": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "metadata": {
+ "description": "Provider-specific payload, parsed from the stored JSON string. Null when the link has no metadata."
+ },
+ "createdAt": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "updatedAt": {
+ "type": "string",
+ "format": "date-time"
+ }
+ },
+ "required": [
+ "id",
+ "taskId",
+ "integrationId",
+ "resourceType",
+ "externalId",
+ "url",
+ "title",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "DeletedExternalLink": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "id"
+ ]
+ },
+ "ExternalLink": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "taskId": {
"type": "string"
},
+ "integrationId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
"resourceType": {
"type": "string",
- "description": "The kind of remote resource, e.g. `issue` or `pull_request`."
+ "description": "The resource kind: `url` for a manual link, or an integration resource such as `issue` or `pull_request`."
},
"externalId": {
"type": "string",
- "description": "The provider's own identifier for the linked resource."
+ "description": "The provider's resource identifier, or the URL for a manual link."
},
"url": {
"type": "string"
@@ -3061,7 +3134,10 @@
]
},
"ExternalLinkIntegration": {
- "type": "object",
+ "type": [
+ "object",
+ "null"
+ ],
"properties": {
"id": {
"type": "string"
@@ -14128,13 +14204,97 @@
}
},
"/external-link/task/{taskId}": {
+ "post": {
+ "operationId": "createExternalLink",
+ "tags": [
+ "External Links"
+ ],
+ "summary": "Create an external link",
+ "description": "Add a resource link to a task",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "name": "taskId",
+ "in": "path"
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "url": {
+ "type": "string",
+ "format": "uri",
+ "description": "An HTTP or HTTPS URL"
+ },
+ "title": {
+ "type": "string",
+ "maxLength": 200
+ }
+ },
+ "required": [
+ "url"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "External link created successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreatedExternalLink"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Invalid external link data",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "No permission to update the task",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
"get": {
"operationId": "getExternalLinksByTask",
"tags": [
"External Links"
],
"summary": "Get task external links",
- "description": "Get all links from a task to resources in connected integrations, such as GitHub or Gitea issues.",
+ "description": "Get manually added resource links and links from connected integrations, such as GitHub or Gitea issues.",
"parameters": [
{
"schema": {
@@ -14185,6 +14345,86 @@
}
}
},
+ "/external-link/task/{taskId}/{id}": {
+ "delete": {
+ "operationId": "deleteExternalLink",
+ "tags": [
+ "External Links"
+ ],
+ "summary": "Remove a manual resource link",
+ "description": "Remove a manually added link from a task. Integration-managed links cannot be removed through this endpoint.",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "name": "taskId",
+ "in": "path"
+ },
+ {
+ "schema": {
+ "type": "string"
+ },
+ "required": true,
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Resource link removed",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DeletedExternalLink"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Unknown task or invalid link data",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "No permission to update the task",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Manual resource link not found on this task",
+ "content": {
+ "text/plain": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
"/workflow-rule/{projectId}": {
"get": {
"operationId": "getWorkflowRules",
diff --git a/apps/web/src/components/external-links/external-links-accordion.test.tsx b/apps/web/src/components/external-links/external-links-accordion.test.tsx
new file mode 100644
index 000000000..ee606f678
--- /dev/null
+++ b/apps/web/src/components/external-links/external-links-accordion.test.tsx
@@ -0,0 +1,201 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import createExternalLink from "@/fetchers/external-link/create-external-link";
+import deleteExternalLink from "@/fetchers/external-link/delete-external-link";
+import { toast } from "@/lib/toast";
+import type { ExternalLink } from "@/types/external-link";
+import { ExternalLinksAccordion } from "./external-links-accordion";
+
+vi.mock("@/fetchers/external-link/delete-external-link", () => ({
+ default: vi.fn(),
+}));
+
+const canUpdateTasks = vi.fn(() => true);
+vi.mock("@/hooks/use-workspace-permission", () => ({
+ useWorkspacePermission: () => ({ canUpdateTasks }),
+}));
+vi.mock("@/fetchers/external-link/create-external-link", () => ({
+ default: vi.fn(),
+}));
+vi.mock("@/lib/toast", () => ({ toast: { error: vi.fn() } }));
+vi.mock("react-i18next", () => ({
+ initReactI18next: { type: "3rdParty", init: vi.fn() },
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ canUpdateTasks.mockReturnValue(true);
+});
+afterEach(cleanup);
+
+function renderResources(externalLinks: ExternalLink[] = []) {
+ const client = new QueryClient({
+ defaultOptions: { mutations: { retry: false } },
+ });
+ const invalidate = vi.spyOn(client, "invalidateQueries");
+ render(
+ <QueryClientProvider client={client}>
+ <ExternalLinksAccordion taskId="task-1" externalLinks={externalLinks} />
+ </QueryClientProvider>,
+ );
+ return invalidate;
+}
+
+async function submitResource() {
+ fireEvent.click(
+ screen.getByRole("button", { name: "settings:externalLinks.addResource" }),
+ );
+ const input = await screen.findByLabelText("settings:externalLinks.url");
+ fireEvent.change(input, {
+ target: { value: "https://example.com/resource" },
+ });
+ fireEvent.submit(input.closest("form") as HTMLFormElement);
+}
+
+describe("manual task resources", () => {
+ it("clears canceled values before reopening the form", async () => {
+ renderResources();
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:externalLinks.addResource",
+ }),
+ );
+ fireEvent.change(
+ await screen.findByLabelText("settings:externalLinks.url"),
+ { target: { value: "https://example.com/canceled" } },
+ );
+ fireEvent.change(
+ screen.getByLabelText("settings:externalLinks.titleOptional"),
+ { target: { value: "Canceled title" } },
+ );
+ fireEvent.click(
+ screen.getByRole("button", { name: "settings:externalLinks.cancel" }),
+ );
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:externalLinks.addResource",
+ }),
+ );
+ expect(
+ await screen.findByLabelText("settings:externalLinks.url"),
+ ).toHaveValue("");
+ expect(
+ screen.getByLabelText("settings:externalLinks.titleOptional"),
+ ).toHaveValue("");
+ });
+
+ it("hides creation from users without task update permission", () => {
+ canUpdateTasks.mockReturnValue(false);
+ renderResources();
+ expect(
+ screen.queryByRole("button", {
+ name: "settings:externalLinks.addResource",
+ }),
+ ).toBeNull();
+ });
+
+ it("keeps failed input available and shows an error", async () => {
+ vi.mocked(createExternalLink).mockRejectedValue(
+ new Error("request rejected"),
+ );
+ const invalidate = renderResources();
+ await submitResource();
+ await waitFor(() =>
+ expect(toast.error).toHaveBeenCalledWith("common:error.messages.unknown"),
+ );
+ expect(screen.getByLabelText("settings:externalLinks.url")).toHaveValue(
+ "https://example.com/resource",
+ );
+ expect(invalidate).not.toHaveBeenCalled();
+ });
+
+ it("refreshes the resource list and closes the form after success", async () => {
+ vi.mocked(createExternalLink).mockResolvedValue(
+ {} as Awaited<ReturnType<typeof createExternalLink>>,
+ );
+ const invalidate = renderResources();
+ await submitResource();
+ await waitFor(() =>
+ expect(invalidate).toHaveBeenCalledWith({
+ queryKey: ["external-links", "task-1"],
+ }),
+ );
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ expect(toast.error).not.toHaveBeenCalled();
+ });
+});
+
+const manualLink: ExternalLink = {
+ id: "link-1",
+ taskId: "task-1",
+ integrationId: null,
+ resourceType: "url",
+ externalId: "https://example.com/design",
+ url: "https://example.com/design",
+ title: "Design",
+ metadata: null,
+};
+
+describe("removing manual resources", () => {
+ it("removes a manual link and refreshes its task's resource list", async () => {
+ vi.mocked(deleteExternalLink).mockResolvedValue({ id: "link-1" });
+ const invalidate = renderResources([manualLink]);
+ fireEvent.click(
+ screen.getByRole("button", { name: "settings:externalLinks.remove" }),
+ );
+ await waitFor(() =>
+ expect(deleteExternalLink).toHaveBeenCalledWith(
+ { taskId: "task-1", id: "link-1" },
+ expect.anything(),
+ ),
+ );
+ await waitFor(() =>
+ expect(invalidate).toHaveBeenCalledWith({
+ queryKey: ["external-links", "task-1"],
+ }),
+ );
+ });
+
+ it("does not offer removal for provider-managed links or viewers", () => {
+ renderResources([
+ { ...manualLink, integrationId: "github-1" },
+ { ...manualLink, id: "issue-1", resourceType: "issue" },
+ ]);
+ expect(
+ screen.queryByRole("button", { name: "settings:externalLinks.remove" }),
+ ).toBeNull();
+ cleanup();
+ canUpdateTasks.mockReturnValue(false);
+ renderResources([manualLink]);
+ expect(
+ screen.queryByRole("button", { name: "settings:externalLinks.remove" }),
+ ).toBeNull();
+ });
+
+ it("keeps a failed removal visible and reports the error", async () => {
+ vi.mocked(deleteExternalLink).mockRejectedValue(new Error("failed"));
+ const invalidate = renderResources([manualLink]);
+ fireEvent.click(
+ screen.getByRole("button", { name: "settings:externalLinks.remove" }),
+ );
+ await waitFor(() =>
+ expect(toast.error).toHaveBeenCalledWith(
+ "settings:externalLinks.removeError",
+ ),
+ );
+ expect(screen.getByRole("link", { name: "Design" })).toHaveAttribute(
+ "href",
+ manualLink.url,
+ );
+ expect(invalidate).not.toHaveBeenCalled();
+ });
+});
diff --git a/apps/web/src/components/external-links/external-links-accordion.tsx b/apps/web/src/components/external-links/external-links-accordion.tsx
index cee165e57..4431b0def 100644
--- a/apps/web/src/components/external-links/external-links-accordion.tsx
+++ b/apps/web/src/components/external-links/external-links-accordion.tsx
@@ -4,6 +4,9 @@ import {
FolderGit,
GitMerge,
GitPullRequest,
+ Link,
+ Plus,
+ X,
} from "lucide-react";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -14,9 +17,22 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";
+import {
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import useCreateExternalLink from "@/hooks/mutations/external-link/use-create-external-link";
+import useDeleteExternalLink from "@/hooks/mutations/external-link/use-delete-external-link";
+import { useWorkspacePermission } from "@/hooks/use-workspace-permission";
import type { ExternalLink } from "@/types/external-link";
interface ExternalLinksAccordionProps {
+ taskId: string;
externalLinks: ExternalLink[];
isLoading?: boolean;
}
@@ -25,30 +41,70 @@ function isGiteaResourceLink(link: ExternalLink) {
if (link.integration?.type === "gitea") {
return true;
}
+
const from = link.metadata?.createdFrom;
return from === "gitea" || from === "gitea-import";
}
export function ExternalLinksAccordion({
+ taskId,
externalLinks,
isLoading,
}: ExternalLinksAccordionProps) {
const { t } = useTranslation();
+ const { canUpdateTasks } = useWorkspacePermission();
+ const canAddResource = canUpdateTasks();
const [isOpen, setIsOpen] = useState(true);
+ const [isDialogOpen, setIsDialogOpen] = useState(false);
+ const [url, setUrl] = useState("");
+ const [title, setTitle] = useState("");
+
+ const createExternalLink = useCreateExternalLink();
+ const deleteExternalLink = useDeleteExternalLink();
const linksWithoutRedundantBranches = useMemo(() => {
const hasPR = externalLinks.some(
(link) => link.resourceType === "pull_request",
);
+
if (hasPR) {
return externalLinks.filter((link) => link.resourceType !== "branch");
}
+
return externalLinks;
}, [externalLinks]);
- if (isLoading || linksWithoutRedundantBranches.length === 0) {
- return null;
- }
+ const resetForm = () => {
+ setUrl("");
+ setTitle("");
+ };
+
+ const handleDialogChange = (open: boolean) => {
+ setIsDialogOpen(open);
+
+ if (!open && !createExternalLink.isPending) {
+ resetForm();
+ }
+ };
+
+ const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
+ event.preventDefault();
+ if (!canAddResource || createExternalLink.isPending) return;
+
+ createExternalLink.mutate(
+ {
+ taskId,
+ url,
+ ...(title.trim() ? { title: title.trim() } : {}),
+ },
+ {
+ onSuccess: () => {
+ setIsDialogOpen(false);
+ resetForm();
+ },
+ },
+ );
+ };
const getStatusBadge = (link: ExternalLink) => {
const isMerged = link.metadata?.merged === true;
@@ -102,51 +158,162 @@ export function ExternalLinksAccordion({
};
return (
- <Collapsible open={isOpen} onOpenChange={setIsOpen} className="w-full">
- <CollapsibleTrigger asChild>
- <Button
- variant="ghost"
- size="sm"
- className="w-full justify-start gap-1 px-0 h-8 hover:bg-transparent"
- >
- {isOpen ? (
- <ChevronDown className="size-4 text-muted-foreground" />
- ) : (
- <ChevronRight className="size-4 text-muted-foreground" />
- )}
- <span className="text-sm text-muted-foreground">
- {t("settings:externalLinks.resources")}
- </span>
- </Button>
- </CollapsibleTrigger>
- <CollapsibleContent>
- <div className="flex flex-col gap-2 mt-2">
- {linksWithoutRedundantBranches.map((link) => (
- <a
- key={link.id}
- href={link.url}
- target="_blank"
- rel="noopener noreferrer"
- className="group flex items-center gap-3 py-2 px-3 rounded-md hover:bg-accent/50 transition-colors"
+ <>
+ <Collapsible open={isOpen} onOpenChange={setIsOpen} className="w-full">
+ <div className="flex items-center justify-between">
+ <CollapsibleTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="justify-start gap-1 px-0 h-8 hover:bg-transparent"
>
- {isGiteaResourceLink(link) ? (
- <FolderGit className="size-4 flex-shrink-0 text-muted-foreground" />
+ {isOpen ? (
+ <ChevronDown className="size-4 text-muted-foreground" />
) : (
- <GithubIcon className="size-4 flex-shrink-0 text-muted-foreground" />
+ <ChevronRight className="size-4 text-muted-foreground" />
)}
- <span className="text-sm truncate flex-1 text-foreground/90 group-hover:text-foreground">
- {link.title || link.externalId}
- {link.resourceType !== "branch" && (
- <span className="text-muted-foreground ml-2">
- #{link.externalId}
- </span>
- )}
+ <span className="text-sm text-muted-foreground">
+ {t("settings:externalLinks.resources")}
</span>
- {getStatusBadge(link)}
- </a>
- ))}
+ </Button>
+ </CollapsibleTrigger>
+
+ {canAddResource && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ className="gap-1 h-8"
+ onClick={() => setIsDialogOpen(true)}
+ >
+ <Plus className="size-4" />
+ {t("settings:externalLinks.addResource")}
+ </Button>
+ )}
</div>
- </CollapsibleContent>
- </Collapsible>
+
+ <CollapsibleContent>
+ {isLoading ? null : linksWithoutRedundantBranches.length > 0 ? (
+ <div className="flex flex-col gap-2 mt-2">
+ {linksWithoutRedundantBranches.map((link) => (
+ <div key={link.id} className="flex items-center gap-1">
+ <a
+ href={link.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="group flex min-w-0 flex-1 items-center gap-3 py-2 px-3 rounded-md hover:bg-accent/50 transition-colors"
+ >
+ {isGiteaResourceLink(link) ? (
+ <FolderGit className="size-4 flex-shrink-0 text-muted-foreground" />
+ ) : link.resourceType === "url" ? (
+ <Link className="size-4 flex-shrink-0 text-muted-foreground" />
+ ) : (
+ <GithubIcon className="size-4 flex-shrink-0 text-muted-foreground" />
+ )}
+
+ <span className="text-sm truncate flex-1 text-foreground/90 group-hover:text-foreground">
+ {link.title || link.externalId}
+ {link.resourceType !== "branch" &&
+ link.resourceType !== "url" && (
+ <span className="text-muted-foreground ml-2">
+ #{link.externalId}
+ </span>
+ )}
+ </span>
+
+ {getStatusBadge(link)}
+ </a>
+ {canAddResource &&
+ link.integrationId === null &&
+ link.resourceType === "url" && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t("settings:externalLinks.remove", {
+ title: link.title || link.url,
+ })}
+ disabled={deleteExternalLink.isPending}
+ onClick={() =>
+ deleteExternalLink.mutate({ taskId, id: link.id })
+ }
+ >
+ <X aria-hidden="true" />
+ </Button>
+ )}
+ </div>
+ ))}
+ </div>
+ ) : (
+ <p className="mt-2 px-3 text-sm text-muted-foreground">
+ {t("settings:externalLinks.empty")}
+ </p>
+ )}
+ </CollapsibleContent>
+ </Collapsible>
+
+ <Dialog
+ open={isDialogOpen && canAddResource}
+ onOpenChange={handleDialogChange}
+ >
+ <DialogContent>
+ <form onSubmit={handleSubmit}>
+ <DialogHeader>
+ <DialogTitle>
+ {t("settings:externalLinks.addResource")}
+ </DialogTitle>
+ </DialogHeader>
+
+ <div className="grid gap-4 py-4">
+ <div className="grid gap-2">
+ <Label htmlFor="external-resource-url">
+ {t("settings:externalLinks.url")}
+ </Label>
+ <Input
+ id="external-resource-url"
+ type="url"
+ value={url}
+ onChange={(event) => setUrl(event.target.value)}
+ required
+ autoFocus
+ />
+ </div>
+
+ <div className="grid gap-2">
+ <Label htmlFor="external-resource-title">
+ {t("settings:externalLinks.titleOptional")}
+ </Label>
+ <Input
+ id="external-resource-title"
+ value={title}
+ onChange={(event) => setTitle(event.target.value)}
+ maxLength={200}
+ />
+ </div>
+ </div>
+
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => handleDialogChange(false)}
+ disabled={createExternalLink.isPending}
+ >
+ {t("settings:externalLinks.cancel")}
+ </Button>
+
+ <Button
+ type="submit"
+ disabled={createExternalLink.isPending || !url.trim()}
+ >
+ {createExternalLink.isPending
+ ? t("settings:externalLinks.adding")
+ : t("settings:externalLinks.addResource")}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ </>
);
}
diff --git a/apps/web/src/components/task/task-details-content.tsx b/apps/web/src/components/task/task-details-content.tsx
index a911976b5..6261adf8e 100644
--- a/apps/web/src/components/task/task-details-content.tsx
+++ b/apps/web/src/components/task/task-details-content.tsx
@@ -185,7 +185,6 @@ export default function TaskDetailsContent({
<TaskTitle taskId={taskId} />
<TaskDescription taskId={taskId} />
</div>
-
{customFields.length > 0 && (
<div className="mt-2">
<Accordion className="w-full">
@@ -416,15 +415,13 @@ export default function TaskDetailsContent({
</div>
)}
- {!isLoadingExternalLinks && externalLinks.length > 0 && (
- <div className="mt-4">
- <ExternalLinksAccordion
- externalLinks={externalLinks as ExternalLink[]}
- isLoading={isLoadingExternalLinks}
- />
- </div>
- )}
-
+ <div className="mt-4">
+ <ExternalLinksAccordion
+ taskId={taskId}
+ externalLinks={externalLinks as ExternalLink[]}
+ isLoading={isLoadingExternalLinks}
+ />
+ </div>
<div className="mt-4">
{task && (
<TaskSubtasks
diff --git a/apps/web/src/fetchers/external-link/create-external-link.ts b/apps/web/src/fetchers/external-link/create-external-link.ts
new file mode 100644
index 000000000..2dbf13496
--- /dev/null
+++ b/apps/web/src/fetchers/external-link/create-external-link.ts
@@ -0,0 +1,30 @@
+import { client } from "@kaneo/libs";
+
+export type CreateExternalLinkRequest = {
+ taskId: string;
+ url: string;
+ title?: string;
+};
+
+async function createExternalLink({
+ taskId,
+ url,
+ title,
+}: CreateExternalLinkRequest) {
+ const response = await client["external-link"].task[":taskId"].$post({
+ param: { taskId },
+ json: {
+ url,
+ ...(title ? { title } : {}),
+ },
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return response.json();
+}
+
+export default createExternalLink;
diff --git a/apps/web/src/fetchers/external-link/delete-external-link.ts b/apps/web/src/fetchers/external-link/delete-external-link.ts
new file mode 100644
index 000000000..1d1693950
--- /dev/null
+++ b/apps/web/src/fetchers/external-link/delete-external-link.ts
@@ -0,0 +1,15 @@
+import { client } from "@kaneo/libs";
+
+export default async function deleteExternalLink({
+ taskId,
+ id,
+}: {
+ taskId: string;
+ id: string;
+}) {
+ const response = await client["external-link"].task[":taskId"][":id"].$delete(
+ { param: { taskId, id } },
+ );
+ if (!response.ok) throw new Error(await response.text());
+ return response.json();
+}
diff --git a/apps/web/src/hooks/mutations/external-link/use-create-external-link.ts b/apps/web/src/hooks/mutations/external-link/use-create-external-link.ts
new file mode 100644
index 000000000..2118afccf
--- /dev/null
+++ b/apps/web/src/hooks/mutations/external-link/use-create-external-link.ts
@@ -0,0 +1,26 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import createExternalLink, {
+ type CreateExternalLinkRequest,
+} from "@/fetchers/external-link/create-external-link";
+import { toast } from "@/lib/toast";
+
+function useCreateExternalLink() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation();
+
+ return useMutation({
+ mutationFn: (request: CreateExternalLinkRequest) =>
+ createExternalLink(request),
+ onSuccess: (_data, variables) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["external-links", variables.taskId],
+ });
+ },
+ onError: () => {
+ toast.error(t("common:error.messages.unknown"));
+ },
+ });
+}
+
+export default useCreateExternalLink;
diff --git a/apps/web/src/hooks/mutations/external-link/use-delete-external-link.ts b/apps/web/src/hooks/mutations/external-link/use-delete-external-link.ts
new file mode 100644
index 000000000..eb0664181
--- /dev/null
+++ b/apps/web/src/hooks/mutations/external-link/use-delete-external-link.ts
@@ -0,0 +1,17 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import deleteExternalLink from "@/fetchers/external-link/delete-external-link";
+import { toast } from "@/lib/toast";
+
+export default function useDeleteExternalLink() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation();
+ return useMutation({
+ mutationFn: deleteExternalLink,
+ onSuccess: (_data, variables) =>
+ queryClient.invalidateQueries({
+ queryKey: ["external-links", variables.taskId],
+ }),
+ onError: () => toast.error(t("settings:externalLinks.removeError")),
+ });
+}
diff --git a/apps/web/src/hooks/use-project-websocket.test.ts b/apps/web/src/hooks/use-project-websocket.test.ts
index 3f9c677c8..e1ea18876 100644
--- a/apps/web/src/hooks/use-project-websocket.test.ts
+++ b/apps/web/src/hooks/use-project-websocket.test.ts
@@ -1,10 +1,47 @@
+import { cleanup, renderHook } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("@kaneo/libs", () => ({
windowId: "test-window-id",
}));
-import { getWsUrl } from "./use-project-websocket";
+import { getWsUrl, useProjectWebSocket } from "./use-project-websocket";
+
+const invalidateQueries = vi.fn();
+vi.mock("@tanstack/react-query", () => ({
+ useQueryClient: () => ({ invalidateQueries }),
+}));
+vi.mock("@/lib/auth-client", () => ({
+ authClient: { useSession: () => ({ data: { user: { id: "user-1" } } }) },
+}));
+
+it("refreshes resource links when another client updates a task", () => {
+ const sockets: FakeWebSocket[] = [];
+ class FakeWebSocket {
+ onmessage: ((event: { data: string }) => void) | null = null;
+ close = vi.fn();
+ constructor() {
+ sockets.push(this);
+ }
+ }
+ vi.stubGlobal("WebSocket", FakeWebSocket);
+ try {
+ renderHook(() => useProjectWebSocket("project-1"));
+ sockets[0].onmessage?.({
+ data: JSON.stringify({
+ type: "TASK_UPDATED",
+ projectId: "project-1",
+ taskId: "task-1",
+ }),
+ });
+ expect(invalidateQueries).toHaveBeenCalledWith({
+ queryKey: ["external-links", "task-1"],
+ });
+ } finally {
+ cleanup();
+ vi.unstubAllGlobals();
+ }
+});
describe("getWsUrl", () => {
beforeEach(() => {
diff --git a/apps/web/src/hooks/use-project-websocket.ts b/apps/web/src/hooks/use-project-websocket.ts
index da36d792d..88667cfbd 100644
--- a/apps/web/src/hooks/use-project-websocket.ts
+++ b/apps/web/src/hooks/use-project-websocket.ts
@@ -109,6 +109,12 @@ export function useProjectWebSocket(projectId: string) {
});
}
+ if (message.type === "TASK_UPDATED" && message.taskId) {
+ queryClient.invalidateQueries({
+ queryKey: ["external-links", message.taskId],
+ });
+ }
+
if (message.type === "COMMENT_UPDATED") {
queryClient.invalidateQueries({
queryKey: ["activities", message.taskId],
diff --git a/apps/web/src/types/external-link/index.ts b/apps/web/src/types/external-link/index.ts
index 6752cd768..a8bcd4fef 100644
--- a/apps/web/src/types/external-link/index.ts
+++ b/apps/web/src/types/external-link/index.ts
@@ -17,7 +17,7 @@ export type ExternalLinkMetadata = {
export type ExternalLink = {
id: string;
taskId: string;
- integrationId: string;
+ integrationId: string | null;
resourceType: string;
externalId: string;
url: string;
@@ -28,5 +28,5 @@ export type ExternalLink = {
integration?: {
id: string;
type: string;
- };
+ } | null;
};
diff --git a/apps/web/src/types/task/index.ts b/apps/web/src/types/task/index.ts
index 3c312a366..b8797a0e7 100644
--- a/apps/web/src/types/task/index.ts
+++ b/apps/web/src/types/task/index.ts
@@ -7,7 +7,7 @@ type TaskLabel = {
type TaskExternalLink = {
id: string;
taskId: string;
- integrationId: string;
+ integrationId: string | null;
resourceType: string;
externalId: string;
url: string;
diff --git a/i18n/az-AZ.json b/i18n/az-AZ.json
index 178ccbd20..bc0376c6a 100644
--- a/i18n/az-AZ.json
+++ b/i18n/az-AZ.json
@@ -1425,7 +1425,15 @@
"branch": "Budaq",
"merged": "Birləşdirilib",
"draft": "Qaralama",
- "open": "Açıq"
+ "open": "Açıq",
+ "adding": "Əlavə edilir...",
+ "addResource": "Resurs əlavə et",
+ "cancel": "Ləğv et",
+ "empty": "Bu tapşırıqla əlaqəli resurs yoxdur.",
+ "titleOptional": "Başlıq (ixtiyari)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"customFields": {
"addButton": "Add",
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index 2ae4ead14..2acdbf946 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -1232,7 +1232,15 @@
"branch": "Branch",
"merged": "Zusammengeführt",
"draft": "Entwurf",
- "open": "Offen"
+ "open": "Offen",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Rollen",
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index 4278ec5a8..1fd30f71f 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -1152,7 +1152,15 @@
"branch": "Κλάδος",
"merged": "Συγχωνευμένο",
"draft": "Πρόχειρο",
- "open": "Ανοιχτό"
+ "open": "Ανοιχτό",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Ρόλοι",
diff --git a/i18n/en-US.json b/i18n/en-US.json
index 2ead020be..b4947cd36 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -1531,7 +1531,15 @@
"branch": "Branch",
"merged": "Merged",
"draft": "Draft",
- "open": "Open"
+ "open": "Open",
+ "addResource": "Add resource",
+ "url": "URL",
+ "titleOptional": "Title (optional)",
+ "cancel": "Cancel",
+ "adding": "Adding...",
+ "empty": "No resources linked to this task.",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"security": "Security",
"securityPage": {
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index 348f2c2fc..a81561c33 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -927,7 +927,15 @@
"branch": "Rama",
"merged": "Merged",
"draft": "Borrador",
- "open": "Abierta"
+ "open": "Abierta",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"notifications": "Notificaciones",
"notificationsPage": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index 315425239..9021a8dfa 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -1152,7 +1152,15 @@
"branch": "Branche",
"merged": "Fusionné",
"draft": "Brouillon",
- "open": "Ouvert"
+ "open": "Ouvert",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Rôles",
diff --git a/i18n/hi-IN.json b/i18n/hi-IN.json
index 42259fddb..3c1f93176 100644
--- a/i18n/hi-IN.json
+++ b/i18n/hi-IN.json
@@ -1387,7 +1387,15 @@
"branch": "ब्रांच",
"merged": "मर्ज किया",
"draft": "ड्राफ़्ट",
- "open": "खुला"
+ "open": "खुला",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"mattermostIntegration": {
"channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
diff --git a/i18n/id-ID.json b/i18n/id-ID.json
index 539854537..5d9778936 100644
--- a/i18n/id-ID.json
+++ b/i18n/id-ID.json
@@ -1152,7 +1152,15 @@
"branch": "Branch",
"merged": "Digabung",
"draft": "Draf",
- "open": "Terbuka"
+ "open": "Terbuka",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Peran",
diff --git a/i18n/it-IT.json b/i18n/it-IT.json
index 7cba49c15..0e8f074b7 100644
--- a/i18n/it-IT.json
+++ b/i18n/it-IT.json
@@ -1388,7 +1388,15 @@
"branch": "Ramo",
"merged": "Unito",
"draft": "Bozza",
- "open": "Aperto"
+ "open": "Aperto",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"mattermostIntegration": {
"channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json
index cd2bdeacf..6d78ceec8 100644
--- a/i18n/ja-JP.json
+++ b/i18n/ja-JP.json
@@ -1386,7 +1386,15 @@
"branch": "ブランチ",
"merged": "マージ済み",
"draft": "下書き",
- "open": "オープン"
+ "open": "オープン",
+ "adding": "追加中...",
+ "addResource": "リソースを追加",
+ "cancel": "キャンセル",
+ "empty": "このタスクにリンクされたリソースはありません。",
+ "titleOptional": "タイトル(任意)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"mattermostIntegration": {
"channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index c9f0398b8..2d67194ab 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -1152,7 +1152,15 @@
"branch": "브랜치",
"merged": "병합됨",
"draft": "초안",
- "open": "열림"
+ "open": "열림",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "역할",
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index 860daac8f..b0a9e756c 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -1152,7 +1152,15 @@
"branch": "Гранка",
"merged": "Споен",
"draft": "Нацрт",
- "open": "Отворен"
+ "open": "Отворен",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Улоги",
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index d5004d02b..cda333a75 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -927,7 +927,15 @@
"branch": "Branch",
"merged": "Samengevoegd",
"draft": "Concept",
- "open": "Open"
+ "open": "Open",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"notifications": "Meldingen",
"notificationsPage": {
diff --git a/i18n/pl-PL.json b/i18n/pl-PL.json
index 096a950a8..d06dbdea2 100644
--- a/i18n/pl-PL.json
+++ b/i18n/pl-PL.json
@@ -978,12 +978,20 @@
"webhookPlaceholder": "https://discord.com/api/webhooks/..."
},
"externalLinks": {
+ "adding": "Dodawanie...",
+ "addResource": "Dodaj zasób",
"branch": "Gałąź",
+ "cancel": "Anuluj",
"draft": "Wersja robocza",
+ "empty": "Brak zasobów powiązanych z tym zadaniem.",
"issue": "Zgłoszenie",
"merged": "Scalone",
"open": "Otwarte",
- "resources": "Zasoby"
+ "resources": "Zasoby",
+ "titleOptional": "Tytuł (opcjonalnie)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"genericWebhookIntegration": {
"connect": "Połącz webhook",
diff --git a/i18n/pt-BR.json b/i18n/pt-BR.json
index abaf4a0c8..afc3dffc2 100644
--- a/i18n/pt-BR.json
+++ b/i18n/pt-BR.json
@@ -1388,7 +1388,15 @@
"branch": "Branch",
"merged": "Mesclado",
"draft": "Rascunho",
- "open": "Aberto"
+ "open": "Aberto",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"mattermostIntegration": {
"channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index 80cf5bdd1..f55f8a29f 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -1160,7 +1160,15 @@
"branch": "Ветка",
"merged": "Влит",
"draft": "Черновик",
- "open": "Открыт"
+ "open": "Открыт",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Роли",
diff --git a/i18n/schema.json b/i18n/schema.json
index 4ece4160e..406c8e02d 100644
--- a/i18n/schema.json
+++ b/i18n/schema.json
@@ -6100,6 +6100,30 @@
},
"open": {
"type": "string"
+ },
+ "addResource": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ },
+ "titleOptional": {
+ "type": "string"
+ },
+ "cancel": {
+ "type": "string"
+ },
+ "adding": {
+ "type": "string"
+ },
+ "empty": {
+ "type": "string"
+ },
+ "remove": {
+ "type": "string"
+ },
+ "removeError": {
+ "type": "string"
}
},
"required": [
@@ -6108,7 +6132,15 @@
"branch",
"merged",
"draft",
- "open"
+ "open",
+ "addResource",
+ "url",
+ "titleOptional",
+ "cancel",
+ "adding",
+ "empty",
+ "remove",
+ "removeError"
]
},
"security": {
@@ -7956,28 +7988,28 @@
"type": "object",
"additionalProperties": false,
"properties": {
- "small": {
+ "large": {
"type": "string"
},
"medium": {
"type": "string"
},
- "large": {
- "type": "string"
- },
"reset": {
"type": "string"
},
"resizeHandle": {
"type": "string"
+ },
+ "small": {
+ "type": "string"
}
},
"required": [
- "small",
- "medium",
"large",
+ "medium",
"reset",
- "resizeHandle"
+ "resizeHandle",
+ "small"
]
}
},
diff --git a/i18n/tr-TR.json b/i18n/tr-TR.json
index 74e44aa7a..3d1beb82f 100644
--- a/i18n/tr-TR.json
+++ b/i18n/tr-TR.json
@@ -1152,7 +1152,15 @@
"branch": "Dal",
"merged": "Birleştirildi",
"draft": "Taslak",
- "open": "Açık"
+ "open": "Açık",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Roller",
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index e3f6cd0c6..d053e99a1 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -1152,7 +1152,15 @@
"branch": "Гілка",
"merged": "Змерджено",
"draft": "Чернетка",
- "open": "Відкрито"
+ "open": "Відкрито",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"workspaceRoles": {
"pageTitle": "Ролі",
diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json
index 1ed55d4a0..ed6e1c8bd 100644
--- a/i18n/vi-VN.json
+++ b/i18n/vi-VN.json
@@ -1386,7 +1386,15 @@
"branch": "Nhánh",
"merged": "Đã gộp",
"draft": "Bản nháp",
- "open": "Đang mở"
+ "open": "Đang mở",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"mattermostIntegration": {
"channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json
index 8bef4c178..77e093e6e 100644
--- a/i18n/zh-CN.json
+++ b/i18n/zh-CN.json
@@ -1424,7 +1424,15 @@
"branch": "分支",
"merged": "已合并",
"draft": "草稿",
- "open": "打开"
+ "open": "打开",
+ "adding": "Adding...",
+ "addResource": "Add resource",
+ "cancel": "Cancel",
+ "empty": "No resources linked to this task.",
+ "titleOptional": "Title (optional)",
+ "url": "URL",
+ "remove": "Remove {{title}}",
+ "removeError": "Failed to remove the resource link."
},
"customFields": {
"addButton": "Add",
diff --git a/tests/api-integration/manual-external-links.test.ts b/tests/api-integration/manual-external-links.test.ts
new file mode 100644
index 000000000..f126e8985
--- /dev/null
+++ b/tests/api-integration/manual-external-links.test.ts
@@ -0,0 +1,240 @@
+import { readFileSync } from "node:fs";
+import { sql } from "drizzle-orm";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import db, { schema } from "../../apps/api/src/database";
+import { createApp } from "../../apps/api/src/index";
+import getTasks from "../../apps/api/src/task/controllers/get-tasks";
+import { boardTaskSchema } from "../../apps/api/src/task/response";
+import { mockAnonymousSession, mockAuthenticatedSession } from "./helpers/auth";
+import { resetTestDatabase } from "./helpers/database";
+import {
+ createProjectFixture,
+ createWorkspaceMember,
+} from "./helpers/fixtures";
+
+const m = vi.hoisted(() => ({ publish: vi.fn(async () => undefined) }));
+vi.mock("../../apps/api/src/events", async (original) => ({
+ ...(await original<object>()),
+ publishEvent: m.publish,
+}));
+beforeEach(async () => {
+ await resetTestDatabase();
+ vi.clearAllMocks();
+});
+async function context(role = "member") {
+ const member = await createWorkspaceMember({ role });
+ const { project } = await createProjectFixture({
+ workspaceId: member.workspace.id,
+ });
+ const [task] = await db
+ .insert(schema.taskTable)
+ .values({ projectId: project.id, title: "Task", number: 1 })
+ .returning();
+ return { ...member, project, task };
+}
+function request(path: string, method: string, body?: unknown) {
+ return createApp().app.request(`/api/external-link/task${path}`, {
+ method,
+ ...(body === undefined
+ ? {}
+ : {
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify(body),
+ }),
+ });
+}
+async function link(
+ taskId: string,
+ integrationId: string | null = null,
+ resourceType = "url",
+) {
+ const [entry] = await db
+ .insert(schema.externalLinkTable)
+ .values({
+ taskId,
+ integrationId,
+ resourceType,
+ externalId: "resource",
+ url: "https://example.com/resource",
+ })
+ .returning();
+ return entry;
+}
+
+describe("manual external resource links", () => {
+ it("upgrades an existing integration link without changing it", async () => {
+ const own = await context();
+ const [integration] = await db
+ .insert(schema.integrationTable)
+ .values({ projectId: own.project.id, type: "github", config: "{}" })
+ .returning();
+ const existing = await link(own.task.id, integration.id, "issue");
+ const migration = readFileSync(
+ new URL(
+ "../../apps/api/drizzle/0051_modern_corsair.sql",
+ import.meta.url,
+ ),
+ "utf8",
+ );
+ await db.transaction(async (tx) => {
+ await tx.execute(
+ sql`ALTER TABLE external_link ALTER COLUMN integration_id SET NOT NULL`,
+ );
+ await tx.execute(sql.raw(migration));
+ expect(await tx.query.externalLinkTable.findMany()).toEqual([existing]);
+ const [manual] = await tx
+ .insert(schema.externalLinkTable)
+ .values({
+ taskId: own.task.id,
+ integrationId: null,
+ resourceType: "url",
+ externalId: "manual",
+ url: "https://example.com/manual",
+ })
+ .returning();
+ expect(manual.integrationId).toBeNull();
+ });
+ });
+
+ it("creates, lists and removes a manual link and publishes both updates", async () => {
+ const own = await context();
+ mockAuthenticatedSession(own.user);
+ const created = await request(`/${own.task.id}`, "POST", {
+ url: "https://example.com/design",
+ title: "Design",
+ });
+ expect(created.status).toBe(200);
+ const entry = (await created.json()) as { id: string };
+ const board = await getTasks(own.project.id);
+ const tasks = [
+ ...board.data.columns.flatMap((column) => column.tasks),
+ ...board.data.plannedTasks,
+ ...board.data.archivedTasks,
+ ];
+ const boardTask = tasks.find((task) => task.id === own.task.id);
+ expect(boardTask?.externalLinks).toMatchObject([
+ { id: entry.id, integrationId: null },
+ ]);
+ expect(boardTaskSchema.safeParse(boardTask).success).toBe(true);
+ const listed = await request(`/${own.task.id}`, "GET");
+ expect(await listed.json()).toMatchObject([
+ { id: entry.id, integrationId: null, integration: null, title: "Design" },
+ ]);
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(200);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(0);
+ expect(m.publish).toHaveBeenCalledTimes(2);
+ expect(m.publish).toHaveBeenLastCalledWith(
+ "task.updated",
+ expect.objectContaining({
+ taskId: own.task.id,
+ projectId: own.project.id,
+ userId: own.user.id,
+ }),
+ );
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(404);
+ expect(m.publish).toHaveBeenCalledTimes(2);
+ });
+
+ it("requires authentication for creation and removal", async () => {
+ const own = await context();
+ const entry = await link(own.task.id);
+ mockAnonymousSession();
+ expect(
+ (await request(`/${own.task.id}`, "POST", { url: "https://example.com" }))
+ .status,
+ ).toBe(401);
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(401);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(1);
+ });
+
+ it("allows viewers to read but not create or remove links", async () => {
+ const own = await context("viewer");
+ const entry = await link(own.task.id);
+ mockAuthenticatedSession(own.user);
+ expect((await request(`/${own.task.id}`, "GET")).status).toBe(200);
+ expect(
+ (await request(`/${own.task.id}`, "POST", { url: "https://example.com" }))
+ .status,
+ ).toBe(403);
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(403);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(1);
+ expect(m.publish).not.toHaveBeenCalled();
+ });
+
+ it("rejects foreign workspace access and an authorized task paired with a foreign link", async () => {
+ const own = await context();
+ const other = await context();
+ const entry = await link(other.task.id);
+ mockAuthenticatedSession(own.user);
+ expect(
+ (
+ await request(`/${other.task.id}`, "POST", {
+ url: "https://example.com",
+ })
+ ).status,
+ ).toBe(403);
+ expect(
+ (await request(`/${other.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(403);
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(404);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(1);
+ expect(m.publish).not.toHaveBeenCalled();
+ });
+
+ it("does not remove another task's link in the same workspace", async () => {
+ const own = await context();
+ const [other] = await db
+ .insert(schema.taskTable)
+ .values({ projectId: own.project.id, title: "Other", number: 2 })
+ .returning();
+ const entry = await link(other.id);
+ mockAuthenticatedSession(own.user);
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(404);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(1);
+ });
+
+ it("preserves provider-managed and non-URL links", async () => {
+ const own = await context();
+ const [integration] = await db
+ .insert(schema.integrationTable)
+ .values({ projectId: own.project.id, type: "github", config: "{}" })
+ .returning();
+ const entries = [
+ await link(own.task.id, integration.id),
+ await link(own.task.id, null, "issue"),
+ ];
+ mockAuthenticatedSession(own.user);
+ for (const entry of entries)
+ expect(
+ (await request(`/${own.task.id}/${entry.id}`, "DELETE")).status,
+ ).toBe(404);
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(2);
+ expect(m.publish).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ "javascript:alert(1)",
+ "data:text/html,hello",
+ "ftp://example.com/file",
+ ])("rejects unsafe URL %s", async (url) => {
+ const own = await context();
+ mockAuthenticatedSession(own.user);
+ expect((await request(`/${own.task.id}`, "POST", { url })).status).toBe(
+ 400,
+ );
+ expect(await db.query.externalLinkTable.findMany()).toHaveLength(0);
+ expect(m.publish).not.toHaveBeenCalled();
+ });
+});
diff --git a/tests/api/external-link/create-external-link.test.ts b/tests/api/external-link/create-external-link.test.ts
new file mode 100644
index 000000000..15567f92e
--- /dev/null
+++ b/tests/api/external-link/create-external-link.test.ts
@@ -0,0 +1,141 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const mockInsert = vi.fn();
+const mockSelect = vi.fn();
+const mockPublishEvent = vi.fn();
+
+vi.mock("../../../apps/api/src/database", () => ({
+ default: {
+ insert: (...args: unknown[]) => mockInsert(...args),
+ select: (...args: unknown[]) => mockSelect(...args),
+ },
+}));
+
+vi.mock("../../../apps/api/src/events", () => ({
+ publishEvent: (...args: unknown[]) => mockPublishEvent(...args),
+}));
+
+import createExternalLink from "../../../apps/api/src/external-link/controllers/create-external-link";
+
+describe("createExternalLink", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+
+ mockSelect.mockReturnValue({
+ from: () => ({
+ innerJoin: () => ({
+ where: () => ({
+ limit: vi.fn().mockResolvedValue([
+ {
+ projectId: "project-1",
+ title: "Test task",
+ status: "todo",
+ },
+ ]),
+ }),
+ }),
+ }),
+ });
+ });
+
+ it("creates an external link and publishes a task update event", async () => {
+ const createdLink = {
+ id: "link-1",
+ taskId: "task-1",
+ integrationId: null,
+ resourceType: "url",
+ externalId: "https://example.com",
+ url: "https://example.com",
+ title: "Example",
+ metadata: null,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ };
+
+ const returning = vi.fn().mockResolvedValue([createdLink]);
+ const values = vi.fn().mockReturnValue({ returning });
+
+ mockInsert.mockReturnValue({ values });
+
+ const result = await createExternalLink({
+ taskId: "task-1",
+ url: "https://example.com",
+ title: "Example",
+ userId: "user-1",
+ });
+
+ expect(values).toHaveBeenCalledWith({
+ taskId: "task-1",
+ integrationId: null,
+ resourceType: "url",
+ externalId: "https://example.com",
+ url: "https://example.com",
+ title: "Example",
+ });
+
+ expect(returning).toHaveBeenCalled();
+ expect(result).toEqual(createdLink);
+
+ expect(mockPublishEvent).toHaveBeenCalledWith("task.updated", {
+ taskId: "task-1",
+ projectId: "project-1",
+ title: "Test task",
+ status: "todo",
+ userId: "user-1",
+ });
+ });
+
+ it("stores null when title is omitted", async () => {
+ const createdLink = {
+ id: "link-2",
+ taskId: "task-1",
+ integrationId: null,
+ resourceType: "url",
+ externalId: "https://example.com",
+ url: "https://example.com",
+ title: null,
+ metadata: null,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ };
+
+ const returning = vi.fn().mockResolvedValue([createdLink]);
+ const values = vi.fn().mockReturnValue({ returning });
+
+ mockInsert.mockReturnValue({ values });
+
+ await createExternalLink({
+ taskId: "task-1",
+ url: "https://example.com",
+ userId: "user-1",
+ });
+
+ expect(values).toHaveBeenCalledWith({
+ taskId: "task-1",
+ integrationId: null,
+ resourceType: "url",
+ externalId: "https://example.com",
+ url: "https://example.com",
+ title: null,
+ });
+ });
+
+ it("throws when the database does not return a created link", async () => {
+ const returning = vi.fn().mockResolvedValue([]);
+ const values = vi.fn().mockReturnValue({ returning });
+
+ mockInsert.mockReturnValue({ values });
+
+ await expect(
+ createExternalLink({
+ taskId: "task-1",
+ url: "https://example.com",
+ userId: "user-1",
+ }),
+ ).rejects.toMatchObject({
+ status: 500,
+ });
+
+ expect(mockPublishEvent).not.toHaveBeenCalled();
+ });
+});
diff --git a/tests/api/external-link/schema.test.ts b/tests/api/external-link/schema.test.ts
new file mode 100644
index 000000000..d8a093ec3
--- /dev/null
+++ b/tests/api/external-link/schema.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import { createExternalLinkBody } from "../../../apps/api/src/external-link/schema";
+
+describe("manual resource URL validation", () => {
+ it.each([
+ "http://example.com",
+ "https://example.com",
+ "HTTPS://example.com",
+ "HtTp://example.com",
+ ])("accepts %s", (url) => {
+ expect(createExternalLinkBody.safeParse({ url }).success).toBe(true);
+ });
+
+ it.each([
+ "ftp://example.com",
+ "javascript:alert(1)",
+ "data:text/plain,test",
+ "not a URL",
+ ])("rejects %s", (url) => {
+ expect(createExternalLinkBody.safeParse({ url }).success).toBe(false);
+ });
+});