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: enhance activity schema and GitHub integration

Andrej Acevskic2a557ef07bc
diff --git a/apps/api/drizzle/0010_bouncy_taskmaster.sql b/apps/api/drizzle/0010_bouncy_taskmaster.sql
new file mode 100644
index 000000000..19989410d
--- /dev/null
+++ b/apps/api/drizzle/0010_bouncy_taskmaster.sql
@@ -0,0 +1,4 @@
+ALTER TABLE "activity" ALTER COLUMN "user_id" DROP NOT NULL;--> statement-breakpoint
+ALTER TABLE "activity" ADD COLUMN "external_user_name" text;--> statement-breakpoint
+ALTER TABLE "activity" ADD COLUMN "external_user_avatar" text;--> statement-breakpoint
+ALTER TABLE "activity" ADD COLUMN "external_source" text;
\ No newline at end of file
diff --git a/apps/api/drizzle/0011_flashy_masked_marvel.sql b/apps/api/drizzle/0011_flashy_masked_marvel.sql
new file mode 100644
index 000000000..f736f3773
--- /dev/null
+++ b/apps/api/drizzle/0011_flashy_masked_marvel.sql
@@ -0,0 +1 @@
+ALTER TABLE "activity" ADD COLUMN "external_url" text;
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0010_snapshot.json b/apps/api/drizzle/meta/0010_snapshot.json
new file mode 100644
index 000000000..ff3defc20
--- /dev/null
+++ b/apps/api/drizzle/meta/0010_snapshot.json
@@ -0,0 +1,1824 @@
+{
+ "id": "a7746291-0fc6-497f-9d2f-c6f5ba2f49b9",
+ "prevId": "4cfeef35-e58e-4076-bbe7-9b7c9396c32f",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_name": {
+ "name": "external_user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_avatar": {
+ "name": "external_user_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_source": {
+ "name": "external_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 86400000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 10
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_userId_idx": {
+ "name": "apikey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "apikey_user_id_user_id_fk": {
+ "name": "apikey_user_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_link": {
+ "name": "external_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "external_link_taskId_idx": {
+ "name": "external_link_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_integrationId_idx": {
+ "name": "external_link_integrationId_idx",
+ "columns": [
+ {
+ "expression": "integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_externalId_idx": {
+ "name": "external_link_externalId_idx",
+ "columns": [
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_resourceType_idx": {
+ "name": "external_link_resourceType_idx",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "external_link_task_id_task_id_fk": {
+ "name": "external_link_task_id_task_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "external_link_integration_id_integration_id_fk": {
+ "name": "external_link_integration_id_integration_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_integration": {
+ "name": "github_integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_owner": {
+ "name": "repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_integration_project_id_project_id_fk": {
+ "name": "github_integration_project_id_project_id_fk",
+ "tableFrom": "github_integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_integration_project_id_unique": {
+ "name": "github_integration_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration": {
+ "name": "integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_projectId_idx": {
+ "name": "integration_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_type_idx": {
+ "name": "integration_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_project_id_project_id_fk": {
+ "name": "integration_project_id_project_id_fk",
+ "tableFrom": "integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_workspaceId_idx": {
+ "name": "invitation_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_workspace_id_workspace_id_fk": {
+ "name": "project_workspace_id_workspace_id_fk",
+ "tableFrom": "project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "teamMember_teamId_idx": {
+ "name": "teamMember_teamId_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teamMember_userId_idx": {
+ "name": "teamMember_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_workspaceId_idx": {
+ "name": "team_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_anonymous": {
+ "name": "is_anonymous",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_member_workspaceId_idx": {
+ "name": "workspace_member_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_member_userId_idx": {
+ "name": "workspace_member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_member_user_id_user_id_fk": {
+ "name": "workspace_member_user_id_user_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0011_snapshot.json b/apps/api/drizzle/meta/0011_snapshot.json
new file mode 100644
index 000000000..e0fcbbd6a
--- /dev/null
+++ b/apps/api/drizzle/meta/0011_snapshot.json
@@ -0,0 +1,1830 @@
+{
+ "id": "95fa9105-bddc-4049-b23d-2c413b803c23",
+ "prevId": "a7746291-0fc6-497f-9d2f-c6f5ba2f49b9",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_name": {
+ "name": "external_user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_avatar": {
+ "name": "external_user_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_source": {
+ "name": "external_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_url": {
+ "name": "external_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 86400000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 10
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_userId_idx": {
+ "name": "apikey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "apikey_user_id_user_id_fk": {
+ "name": "apikey_user_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_link": {
+ "name": "external_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "external_link_taskId_idx": {
+ "name": "external_link_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_integrationId_idx": {
+ "name": "external_link_integrationId_idx",
+ "columns": [
+ {
+ "expression": "integration_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_externalId_idx": {
+ "name": "external_link_externalId_idx",
+ "columns": [
+ {
+ "expression": "external_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "external_link_resourceType_idx": {
+ "name": "external_link_resourceType_idx",
+ "columns": [
+ {
+ "expression": "resource_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "external_link_task_id_task_id_fk": {
+ "name": "external_link_task_id_task_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "external_link_integration_id_integration_id_fk": {
+ "name": "external_link_integration_id_integration_id_fk",
+ "tableFrom": "external_link",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.github_integration": {
+ "name": "github_integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_owner": {
+ "name": "repository_owner",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository_name": {
+ "name": "repository_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installation_id": {
+ "name": "installation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "github_integration_project_id_project_id_fk": {
+ "name": "github_integration_project_id_project_id_fk",
+ "tableFrom": "github_integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "github_integration_project_id_unique": {
+ "name": "github_integration_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration": {
+ "name": "integration",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_projectId_idx": {
+ "name": "integration_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "integration_type_idx": {
+ "name": "integration_type_idx",
+ "columns": [
+ {
+ "expression": "type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_project_id_project_id_fk": {
+ "name": "integration_project_id_project_id_fk",
+ "tableFrom": "integration",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_workspaceId_idx": {
+ "name": "invitation_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_workspace_id_workspace_id_fk": {
+ "name": "project_workspace_id_workspace_id_fk",
+ "tableFrom": "project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "teamMember_teamId_idx": {
+ "name": "teamMember_teamId_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teamMember_userId_idx": {
+ "name": "teamMember_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_workspaceId_idx": {
+ "name": "team_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_anonymous": {
+ "name": "is_anonymous",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_member_workspaceId_idx": {
+ "name": "workspace_member_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_member_userId_idx": {
+ "name": "workspace_member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_member_user_id_user_id_fk": {
+ "name": "workspace_member_user_id_user_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index db4fb0727..62872bb16 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -71,6 +71,20 @@
"when": 1766950050412,
"tag": "0009_harsh_blacklash",
"breakpoints": true
+ },
+ {
+ "idx": 10,
+ "version": "7",
+ "when": 1767037216750,
+ "tag": "0010_bouncy_taskmaster",
+ "breakpoints": true
+ },
+ {
+ "idx": 11,
+ "version": "7",
+ "when": 1767037714394,
+ "tag": "0011_flashy_masked_marvel",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 2822f3e56..fd019dfdb 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -266,13 +266,15 @@ export const activityTable = pgTable("activity", {
}),
type: text("type").notNull(),
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
- userId: text("user_id")
- .notNull()
- .references(() => userTable.id, {
- onDelete: "cascade",
- onUpdate: "cascade",
- }),
+ userId: text("user_id").references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
content: text("content"),
+ externalUserName: text("external_user_name"),
+ externalUserAvatar: text("external_user_avatar"),
+ externalSource: text("external_source"),
+ externalUrl: text("external_url"),
});
export const labelTable = pgTable("label", {
diff --git a/apps/api/src/label/controllers/create-label.ts b/apps/api/src/label/controllers/create-label.ts
index 32965e544..4875ddc8b 100644
--- a/apps/api/src/label/controllers/create-label.ts
+++ b/apps/api/src/label/controllers/create-label.ts
@@ -1,5 +1,6 @@
import db from "../../database";
import { labelTable } from "../../database/schema";
+import { syncLabelToGitHub } from "../../plugins/github/utils/sync-label-to-github";
async function createLabel(
name: string,
@@ -12,6 +13,12 @@ async function createLabel(
.values({ name, color, taskId, workspaceId })
.returning();
+ if (taskId) {
+ syncLabelToGitHub(taskId, name, color).catch((error) => {
+ console.error("Failed to sync label to GitHub:", error);
+ });
+ }
+
return label;
}
diff --git a/apps/api/src/label/controllers/delete-label.ts b/apps/api/src/label/controllers/delete-label.ts
index b09be69b2..8dddb4b4b 100644
--- a/apps/api/src/label/controllers/delete-label.ts
+++ b/apps/api/src/label/controllers/delete-label.ts
@@ -2,9 +2,10 @@ import { eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
import { labelTable } from "../../database/schema";
+import { removeLabelFromGitHub } from "../../plugins/github/utils/sync-label-to-github";
async function deleteLabel(id: string) {
- const label = db.query.labelTable.findFirst({
+ const label = await db.query.labelTable.findFirst({
where: (label, { eq }) => eq(label.id, id),
});
@@ -19,6 +20,14 @@ async function deleteLabel(id: string) {
.where(eq(labelTable.id, id))
.returning();
+ if (deletedLabel?.taskId) {
+ removeLabelFromGitHub(deletedLabel.taskId, deletedLabel.name).catch(
+ (error) => {
+ console.error("Failed to remove label from GitHub:", error);
+ },
+ );
+ }
+
return deletedLabel;
}
diff --git a/apps/api/src/plugins/github/utils/branch-matcher.ts b/apps/api/src/plugins/github/utils/branch-matcher.ts
index 2aeb1f907..69cdeccc0 100644
--- a/apps/api/src/plugins/github/utils/branch-matcher.ts
+++ b/apps/api/src/plugins/github/utils/branch-matcher.ts
@@ -31,7 +31,8 @@ export function createBranchRegex(
.replace("\\{number\\}", "(\\d+)")
.replace("\\{title\\}", "([a-z0-9-]+)");
- return new RegExp(`^${regexPattern}$`, "i");
+ // Allow optional suffix after the pattern (e.g., lif-3-part-1)
+ return new RegExp(`^${regexPattern}(?:-.*)?$`, "i");
}
export function extractTaskNumberFromBranch(
diff --git a/apps/api/src/plugins/github/utils/sync-label-to-github.ts b/apps/api/src/plugins/github/utils/sync-label-to-github.ts
new file mode 100644
index 000000000..cfddfff99
--- /dev/null
+++ b/apps/api/src/plugins/github/utils/sync-label-to-github.ts
@@ -0,0 +1,156 @@
+import { eq } from "drizzle-orm";
+import db from "../../../database";
+import { externalLinkTable } from "../../../database/schema";
+import { getInstallationOctokit } from "./github-app";
+
+const namedColorToHex: Record<string, string> = {
+ red: "EF4444",
+ orange: "F97316",
+ amber: "F59E0B",
+ yellow: "EAB308",
+ lime: "84CC16",
+ green: "22C55E",
+ emerald: "10B981",
+ teal: "14B8A6",
+ cyan: "06B6D4",
+ sky: "0EA5E9",
+ blue: "3B82F6",
+ indigo: "6366F1",
+ violet: "8B5CF6",
+ purple: "A855F7",
+ fuchsia: "D946EF",
+ pink: "EC4899",
+ rose: "F43F5E",
+ gray: "6B7280",
+ slate: "64748B",
+ zinc: "71717A",
+ neutral: "737373",
+ stone: "78716C",
+};
+
+function toHexColor(color: string): string {
+ const lower = color.toLowerCase().replace(/^#/, "");
+ if (namedColorToHex[lower]) {
+ return namedColorToHex[lower];
+ }
+ if (/^[0-9a-f]{6}$/i.test(lower)) {
+ return lower;
+ }
+ if (/^[0-9a-f]{3}$/i.test(lower)) {
+ const [r, g, b] = lower.split("");
+ return `${r}${r}${g}${g}${b}${b}`;
+ }
+ return "6B7280";
+}
+
+async function getGitHubContext(taskId: string) {
+ const externalLink = await db.query.externalLinkTable.findFirst({
+ where: eq(externalLinkTable.taskId, taskId),
+ with: {
+ integration: true,
+ },
+ });
+
+ if (!externalLink || externalLink.resourceType !== "issue") {
+ return null;
+ }
+
+ const integration = externalLink.integration;
+ if (!integration || integration.type !== "github") {
+ return null;
+ }
+
+ let config: {
+ repositoryOwner: string;
+ repositoryName: string;
+ installationId?: number;
+ };
+ try {
+ config = JSON.parse(integration.config);
+ } catch {
+ return null;
+ }
+
+ if (!config.installationId) {
+ return null;
+ }
+
+ const octokit = await getInstallationOctokit(config.installationId);
+ if (!octokit) {
+ return null;
+ }
+
+ return {
+ octokit,
+ owner: config.repositoryOwner,
+ repo: config.repositoryName,
+ issueNumber: Number.parseInt(externalLink.externalId, 10),
+ };
+}
+
+export async function syncLabelToGitHub(
+ taskId: string,
+ labelName: string,
+ labelColor: string,
+) {
+ const ctx = await getGitHubContext(taskId);
+ if (!ctx) return;
+
+ const { octokit, owner, repo, issueNumber } = ctx;
+ const color = toHexColor(labelColor);
+
+ try {
+ await octokit.rest.issues.getLabel({
+ owner,
+ repo,
+ name: labelName,
+ });
+ } catch {
+ try {
+ await octokit.rest.issues.createLabel({
+ owner,
+ repo,
+ name: labelName,
+ color,
+ });
+ } catch (createError) {
+ console.error(
+ `Failed to create label "${labelName}" in GitHub:`,
+ createError,
+ );
+ return;
+ }
+ }
+
+ try {
+ await octokit.rest.issues.addLabels({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ labels: [labelName],
+ });
+ } catch (error) {
+ console.error(`Failed to add label "${labelName}" to GitHub issue:`, error);
+ }
+}
+
+export async function removeLabelFromGitHub(taskId: string, labelName: string) {
+ const ctx = await getGitHubContext(taskId);
+ if (!ctx) return;
+
+ const { octokit, owner, repo, issueNumber } = ctx;
+
+ try {
+ await octokit.rest.issues.removeLabel({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ name: labelName,
+ });
+ } catch (error) {
+ console.error(
+ `Failed to remove label "${labelName}" from GitHub issue:`,
+ error,
+ );
+ }
+}
diff --git a/apps/api/src/plugins/github/webhook-handler.ts b/apps/api/src/plugins/github/webhook-handler.ts
index ff22ca0d8..1ed485ece 100644
--- a/apps/api/src/plugins/github/webhook-handler.ts
+++ b/apps/api/src/plugins/github/webhook-handler.ts
@@ -1,6 +1,9 @@
import { getGithubApp } from "./utils/github-app";
import { handleIssueClosed } from "./webhooks/issue-closed";
+import { handleIssueCommentCreated } from "./webhooks/issue-comment-created";
+import { handleIssueLabeled } from "./webhooks/issue-labeled";
import { handleIssueOpened } from "./webhooks/issue-opened";
+import { handleLabelCreated } from "./webhooks/label-created";
import { handlePullRequestClosed } from "./webhooks/pull-request-closed";
import { handlePullRequestOpened } from "./webhooks/pull-request-opened";
import { handlePush } from "./webhooks/push";
@@ -20,7 +23,12 @@ export async function handleGitHubWebhook(
try {
await githubApp.webhooks.verifyAndReceive({
id: deliveryId,
- name: eventName as "issues" | "pull_request" | "push",
+ name: eventName as
+ | "issues"
+ | "pull_request"
+ | "push"
+ | "label"
+ | "issue_comment",
signature,
payload: body,
});
@@ -52,6 +60,18 @@ export function setupWebhookHandlers() {
await handleIssueClosed(payload as Parameters<typeof handleIssueClosed>[0]);
});
+ githubApp.webhooks.on("issues.labeled", async ({ payload }) => {
+ await handleIssueLabeled(
+ payload as Parameters<typeof handleIssueLabeled>[0],
+ );
+ });
+
+ githubApp.webhooks.on("issues.unlabeled", async ({ payload }) => {
+ await handleIssueLabeled(
+ payload as Parameters<typeof handleIssueLabeled>[0],
+ );
+ });
+
githubApp.webhooks.on("push", async ({ payload }) => {
await handlePush(payload as Parameters<typeof handlePush>[0]);
});
@@ -74,5 +94,17 @@ export function setupWebhookHandlers() {
);
});
+ githubApp.webhooks.on("label.created", async ({ payload }) => {
+ await handleLabelCreated(
+ payload as Parameters<typeof handleLabelCreated>[0],
+ );
+ });
+
+ githubApp.webhooks.on("issue_comment.created", async ({ payload }) => {
+ await handleIssueCommentCreated(
+ payload as Parameters<typeof handleIssueCommentCreated>[0],
+ );
+ });
+
console.log("✓ GitHub webhook handlers registered");
}
diff --git a/apps/api/src/plugins/github/webhooks/issue-comment-created.ts b/apps/api/src/plugins/github/webhooks/issue-comment-created.ts
new file mode 100644
index 000000000..68ace8efb
--- /dev/null
+++ b/apps/api/src/plugins/github/webhooks/issue-comment-created.ts
@@ -0,0 +1,69 @@
+import db from "../../../database";
+import { activityTable } from "../../../database/schema";
+import { findExternalLink } from "../services/link-manager";
+import { findIntegrationByRepo } from "../services/task-service";
+
+type IssueCommentCreatedPayload = {
+ action: string;
+ issue: {
+ number: number;
+ };
+ comment: {
+ id: number;
+ body: string;
+ html_url: string;
+ user: {
+ login: string;
+ avatar_url: string;
+ } | null;
+ created_at: string;
+ };
+ repository: {
+ owner: { login: string };
+ name: string;
+ };
+};
+
+export async function handleIssueCommentCreated(
+ payload: IssueCommentCreatedPayload,
+) {
+ const { issue, comment, repository } = payload;
+
+ if (payload.action !== "created") {
+ return;
+ }
+
+ const username = comment.user?.login ?? "";
+ if (username.endsWith("[bot]")) {
+ return;
+ }
+
+ const integration = await findIntegrationByRepo(
+ repository.owner.login,
+ repository.name,
+ );
+
+ if (!integration) {
+ return;
+ }
+
+ const existingLink = await findExternalLink(
+ integration.id,
+ "issue",
+ issue.number.toString(),
+ );
+
+ if (!existingLink) {
+ return;
+ }
+
+ await db.insert(activityTable).values({
+ taskId: existingLink.taskId,
+ type: "comment",
+ content: comment.body,
+ externalUserName: comment.user?.login ?? "Unknown",
+ externalUserAvatar: comment.user?.avatar_url ?? null,
+ externalSource: "github",
+ externalUrl: comment.html_url,
+ });
+}
diff --git a/apps/api/src/plugins/github/webhooks/issue-labeled.ts b/apps/api/src/plugins/github/webhooks/issue-labeled.ts
new file mode 100644
index 000000000..25141c081
--- /dev/null
+++ b/apps/api/src/plugins/github/webhooks/issue-labeled.ts
@@ -0,0 +1,124 @@
+import { eq } from "drizzle-orm";
+import db from "../../../database";
+import { labelTable, projectTable, taskTable } from "../../../database/schema";
+import { findExternalLink } from "../services/link-manager";
+import { findIntegrationByRepo } from "../services/task-service";
+import {
+ extractIssuePriority,
+ extractIssueStatus,
+} from "../utils/extract-priority";
+
+type IssueLabeledPayload = {
+ action: string;
+ issue: {
+ number: number;
+ labels?: Array<string | { name?: string }>;
+ };
+ label?: {
+ name: string;
+ color: string;
+ };
+ repository: {
+ owner: { login: string };
+ name: string;
+ };
+};
+
+export async function handleIssueLabeled(payload: IssueLabeledPayload) {
+ const { issue, repository, label: addedLabel } = payload;
+
+ const integration = await findIntegrationByRepo(
+ repository.owner.login,
+ repository.name,
+ );
+
+ if (!integration) {
+ return;
+ }
+
+ const existingLink = await findExternalLink(
+ integration.id,
+ "issue",
+ issue.number.toString(),
+ );
+
+ if (!existingLink) {
+ return;
+ }
+
+ const priority = extractIssuePriority(issue.labels);
+ const status = extractIssueStatus(issue.labels);
+
+ const updateData: Record<string, unknown> = {};
+
+ if (priority) {
+ updateData.priority = priority;
+ }
+
+ if (status) {
+ updateData.status = status;
+ }
+
+ if (Object.keys(updateData).length > 0) {
+ await db
+ .update(taskTable)
+ .set(updateData)
+ .where(eq(taskTable.id, existingLink.taskId));
+ }
+
+ if (!addedLabel) {
+ return;
+ }
+
+ const isSystemLabel =
+ addedLabel.name.startsWith("priority:") ||
+ addedLabel.name.startsWith("status:");
+
+ if (isSystemLabel) {
+ return;
+ }
+
+ if (payload.action === "labeled") {
+ const task = await db.query.taskTable.findFirst({
+ where: eq(taskTable.id, existingLink.taskId),
+ with: {
+ project: true,
+ },
+ });
+
+ if (task?.project?.workspaceId) {
+ const existingLabel = await db.query.labelTable.findFirst({
+ where: (table, { and, eq }) =>
+ and(
+ eq(table.workspaceId, task.project.workspaceId),
+ eq(table.name, addedLabel.name),
+ eq(table.taskId, task.id),
+ ),
+ });
+
+ if (!existingLabel) {
+ const color = addedLabel.color ? `#${addedLabel.color}` : "#6B7280";
+ await db.insert(labelTable).values({
+ name: addedLabel.name,
+ color,
+ taskId: task.id,
+ workspaceId: task.project.workspaceId,
+ });
+ }
+ }
+ }
+
+ if (payload.action === "unlabeled") {
+ const labelsToDelete = await db.query.labelTable.findMany({
+ where: (table, { and, eq }) =>
+ and(
+ eq(table.taskId, existingLink.taskId),
+ eq(table.name, addedLabel.name),
+ ),
+ });
+
+ for (const label of labelsToDelete) {
+ await db.delete(labelTable).where(eq(labelTable.id, label.id));
+ }
+ }
+}
diff --git a/apps/api/src/plugins/github/webhooks/issue-opened.ts b/apps/api/src/plugins/github/webhooks/issue-opened.ts
index 08560f384..5c7f47faa 100644
--- a/apps/api/src/plugins/github/webhooks/issue-opened.ts
+++ b/apps/api/src/plugins/github/webhooks/issue-opened.ts
@@ -1,5 +1,6 @@
+import { eq } from "drizzle-orm";
import db from "../../../database";
-import { taskTable } from "../../../database/schema";
+import { projectTable, taskTable } from "../../../database/schema";
import getNextTaskNumber from "../../../task/controllers/get-next-task-number";
import type { GitHubConfig } from "../config";
import { createExternalLink, findExternalLink } from "../services/link-manager";
@@ -104,6 +105,19 @@ export async function handleIssueOpened(payload: IssueOpenedPayload) {
},
});
+ const project = await db.query.projectTable.findFirst({
+ where: eq(projectTable.id, projectId),
+ });
+
+ if (!project) {
+ console.error("Project not found for task linking comment");
+ return;
+ }
+
+ const clientUrl = process.env.KANEO_CLIENT_URL || "http://localhost:5173";
+ const taskUrl = `${clientUrl}/dashboard/workspace/${project.workspaceId}/project/${projectId}/task/${createdTask.id}`;
+ const taskIdentifier = `${project.slug.toUpperCase()}-${createdTask.number}`;
+
try {
let installationId = config.installationId;
if (!installationId) {
@@ -141,7 +155,14 @@ export async function handleIssueOpened(payload: IssueOpenedPayload) {
labelsToAdd,
);
}
+
+ await octokit.rest.issues.createComment({
+ owner: repository.owner.login,
+ repo: repository.name,
+ issue_number: issue.number,
+ body: `[${taskIdentifier}](${taskUrl})`,
+ });
} catch (error) {
- console.error("Failed to add labels to GitHub issue:", error);
+ console.error("Failed to process GitHub issue:", error);
}
}
diff --git a/apps/api/src/plugins/github/webhooks/label-created.ts b/apps/api/src/plugins/github/webhooks/label-created.ts
new file mode 100644
index 000000000..c018fd1ed
--- /dev/null
+++ b/apps/api/src/plugins/github/webhooks/label-created.ts
@@ -0,0 +1,58 @@
+import { eq } from "drizzle-orm";
+import db from "../../../database";
+import { labelTable, projectTable } from "../../../database/schema";
+import { findIntegrationByRepo } from "../services/task-service";
+
+type LabelCreatedPayload = {
+ action: string;
+ label: {
+ name: string;
+ color: string;
+ description?: string | null;
+ };
+ repository: {
+ owner: { login: string };
+ name: string;
+ };
+};
+
+export async function handleLabelCreated(payload: LabelCreatedPayload) {
+ const { repository, label } = payload;
+
+ const integration = await findIntegrationByRepo(
+ repository.owner.login,
+ repository.name,
+ );
+
+ if (!integration?.project) {
+ return;
+ }
+
+ const project = await db.query.projectTable.findFirst({
+ where: eq(projectTable.id, integration.project.id),
+ });
+
+ if (!project?.workspaceId) {
+ return;
+ }
+
+ const labelExists = await db.query.labelTable.findFirst({
+ where: (table, { and, eq }) =>
+ and(
+ eq(table.workspaceId, project.workspaceId),
+ eq(table.name, label.name),
+ ),
+ });
+
+ if (labelExists) {
+ return;
+ }
+
+ const color = label.color ? `#${label.color}` : "#6B7280";
+
+ await db.insert(labelTable).values({
+ name: label.name,
+ color,
+ workspaceId: project.workspaceId,
+ });
+}
diff --git a/apps/api/src/plugins/github/webhooks/pull-request-closed.ts b/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
index c0a834730..7159d66c7 100644
--- a/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
+++ b/apps/api/src/plugins/github/webhooks/pull-request-closed.ts
@@ -74,7 +74,22 @@ export async function handlePullRequestClosed(payload: PRClosedPayload) {
});
if (pull_request.merged) {
- const targetStatus = config.statusTransitions?.onPRMerge || "done";
- await updateTaskStatus(task.id, targetStatus);
+ const allTaskPRs = await db.query.externalLinkTable.findMany({
+ where: and(
+ eq(externalLinkTable.taskId, task.id),
+ eq(externalLinkTable.resourceType, "pull_request"),
+ ),
+ });
+
+ const hasOpenPRs = allTaskPRs.some((pr) => {
+ if (pr.id === externalLink.id) return false;
+ const metadata = pr.metadata ? JSON.parse(pr.metadata) : {};
+ return metadata.state === "open";
+ });
+
+ if (!hasOpenPRs) {
+ const targetStatus = config.statusTransitions?.onPRMerge || "done";
+ await updateTaskStatus(task.id, targetStatus);
+ }
}
}
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index c15c27337..c3f6afb94 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -63,8 +63,12 @@ export const activitySchema = v.object({
"create",
] as const),
createdAt: v.date(),
- userId: v.string(),
+ userId: v.nullable(v.string()),
content: v.nullable(v.string()),
+ externalUserName: v.nullable(v.string()),
+ externalUserAvatar: v.nullable(v.string()),
+ externalSource: v.nullable(v.string()),
+ externalUrl: v.nullable(v.string()),
});
export const timeEntrySchema = v.object({
diff --git a/apps/web/src/components/activity/comment-card.tsx b/apps/web/src/components/activity/comment-card.tsx
index d85bc9dd9..f96e8b984 100644
--- a/apps/web/src/components/activity/comment-card.tsx
+++ b/apps/web/src/components/activity/comment-card.tsx
@@ -16,6 +16,8 @@ import {
Bold,
Check,
Code,
+ ExternalLink,
+ Github,
Heading1,
Heading2,
Heading3,
@@ -60,6 +62,8 @@ type CommentCardProps = {
image?: string | null;
} | null;
createdAt: string;
+ externalSource?: string | null;
+ externalUrl?: string | null;
};
export default function CommentCard({
@@ -68,6 +72,8 @@ export default function CommentCard({
content,
user,
createdAt,
+ externalSource,
+ externalUrl,
}: CommentCardProps) {
const { theme } = useUserPreferencesStore();
const { user: currentUser } = useAuth();
@@ -211,6 +217,10 @@ export default function CommentCard({
editorElement?.removeEventListener("keydown", handleKeyDown);
};
}, [editor, isEditing, handleSave, handleCancel]);
+ const isFromGitHub = externalSource === "github";
+ const githubProfileUrl =
+ isFromGitHub && user?.name ? `https://github.com/${user.name}` : null;
+ const commentUrl = externalUrl || null;
return (
<div className="w-full group">
@@ -229,9 +239,9 @@ export default function CommentCard({
</span>
</div>
</HoverCardTrigger>
- <HoverCardContent className="w-52 p-3">
+ <HoverCardContent className="w-64 p-3">
<div className="flex items-center gap-3">
- <Avatar className="h-8 w-8">
+ <Avatar className="h-10 w-10">
<AvatarImage src={user?.image ?? ""} alt={user?.name || ""} />
<AvatarFallback className="text-xs font-medium bg-muted">
{user?.name?.charAt(0).toUpperCase()}
@@ -241,16 +251,51 @@ export default function CommentCard({
<p className="text-sm font-medium text-foreground leading-none">
{user?.name}
</p>
- <p className="text-xs text-muted-foreground mt-1">
- {user?.email}
- </p>
+ {user?.email && (
+ <p className="text-xs text-muted-foreground mt-1">
+ {user.email}
+ </p>
+ )}
+ {isFromGitHub && (
+ <div className="flex items-center gap-1 mt-1.5">
+ <Github className="size-3 text-muted-foreground" />
+ <span className="text-xs text-muted-foreground">
+ GitHub
+ </span>
+ </div>
+ )}
</div>
</div>
+ {githubProfileUrl && (
+ <a
+ href={githubProfileUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center gap-1.5 mt-3 pt-3 border-t border-border text-xs text-muted-foreground hover:text-foreground transition-colors"
+ >
+ <ExternalLink className="size-3" />
+ View GitHub Profile
+ </a>
+ )}
</HoverCardContent>
</HoverCard>
<span className="text-xs text-muted-foreground/60">
{formatDistanceToNow(createdAt, { addSuffix: true })}
</span>
+ {commentUrl && (
+ <>
+ <span className="text-xs text-muted-foreground/40">·</span>
+ <a
+ href={commentUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1"
+ >
+ <Github className="size-3" />
+ commented on GitHub
+ </a>
+ </>
+ )}
{canEdit && !isEditing && (
<TooltipProvider>
<Tooltip>
diff --git a/apps/web/src/components/activity/index.tsx b/apps/web/src/components/activity/index.tsx
index fe41be456..41a4fcdfb 100644
--- a/apps/web/src/components/activity/index.tsx
+++ b/apps/web/src/components/activity/index.tsx
@@ -40,8 +40,12 @@ function Activity({
content: string | null;
id: string;
createdAt: string;
- userId: string;
+ userId: string | null;
taskId: string;
+ externalUserName?: string | null;
+ externalUserAvatar?: string | null;
+ externalSource?: string | null;
+ externalUrl?: string | null;
};
isLast?: boolean;
}) {
@@ -51,13 +55,27 @@ function Activity({
workspaceId: workspace?.id,
});
- const user = workspaceUsers?.find(
- (user) => user.user?.id === activity.userId,
- );
+ const user = activity.userId
+ ? workspaceUsers?.find((user) => user.user?.id === activity.userId)
+ : null;
- console.log(activity);
+ const isExternalComment = Boolean(activity.externalSource);
if (activity.type === "comment" && activity.content) {
+ const commentUser = isExternalComment
+ ? {
+ id: undefined,
+ name: activity.externalUserName ?? "GitHub User",
+ email: undefined,
+ image: activity.externalUserAvatar ?? undefined,
+ }
+ : {
+ id: user?.user?.id,
+ name: user?.user?.name,
+ email: user?.user?.email,
+ image: user?.user?.image,
+ };
+
return (
<div className="relative flex gap-3 py-2 last:pb-0">
{!isLast && (
@@ -80,13 +98,10 @@ function Activity({
commentId={activity.id}
taskId={activity.taskId}
content={activity.content}
- user={{
- id: user?.user?.id,
- name: user?.user?.name,
- email: user?.user?.email,
- image: user?.user?.image,
- }}
+ user={commentUser}
createdAt={activity.createdAt}
+ externalSource={activity.externalSource}
+ externalUrl={activity.externalUrl}
/>
</div>
</div>
diff --git a/apps/web/src/components/external-links/external-links-accordion.tsx b/apps/web/src/components/external-links/external-links-accordion.tsx
new file mode 100644
index 000000000..9a1fe8d97
--- /dev/null
+++ b/apps/web/src/components/external-links/external-links-accordion.tsx
@@ -0,0 +1,141 @@
+import {
+ ChevronDown,
+ ChevronRight,
+ Github,
+ GitMerge,
+ GitPullRequest,
+} from "lucide-react";
+import { useMemo, useState } from "react";
+import { Button } from "@/components/ui/button";
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from "@/components/ui/collapsible";
+
+interface ExternalLink {
+ id: string;
+ resourceType: "issue" | "pull_request" | "branch";
+ externalId: string;
+ url: string;
+ title?: string | null;
+ metadata?: Record<string, unknown>;
+}
+
+interface ExternalLinksAccordionProps {
+ externalLinks: ExternalLink[];
+ isLoading?: boolean;
+}
+
+export function ExternalLinksAccordion({
+ externalLinks,
+ isLoading,
+}: ExternalLinksAccordionProps) {
+ const [isOpen, setIsOpen] = useState(true);
+
+ 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 getStatusBadge = (link: ExternalLink) => {
+ const isMerged = link.metadata?.merged === true;
+ const isDraft = link.metadata?.draft === true;
+ const isPR = link.resourceType === "pull_request";
+ const isIssue = link.resourceType === "issue";
+ const isBranch = link.resourceType === "branch";
+
+ if (isIssue) {
+ return (
+ <span className="text-xs font-medium text-muted-foreground">Issue</span>
+ );
+ }
+
+ if (isBranch) {
+ return (
+ <span className="text-xs font-medium text-muted-foreground">
+ Branch
+ </span>
+ );
+ }
+
+ if (!isPR) return null;
+
+ if (isMerged) {
+ return (
+ <span className="text-xs font-medium text-purple-500 flex items-center gap-1">
+ <GitMerge className="size-3" />
+ Merged
+ </span>
+ );
+ }
+
+ if (isDraft) {
+ return (
+ <span className="text-xs font-medium text-muted-foreground flex items-center gap-1">
+ <GitPullRequest className="size-3" />
+ Draft
+ </span>
+ );
+ }
+
+ return (
+ <span className="text-xs font-medium text-green-500 flex items-center gap-1">
+ <GitPullRequest className="size-3" />
+ Open
+ </span>
+ );
+ };
+
+ 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">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"
+ >
+ <Github 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" && (
+ <span className="text-muted-foreground ml-2">
+ #{link.externalId}
+ </span>
+ )}
+ </span>
+ {getStatusBadge(link)}
+ </a>
+ ))}
+ </div>
+ </CollapsibleContent>
+ </Collapsible>
+ );
+}
diff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsx
index 4c9ce5957..40dbb79b3 100644
--- a/apps/web/src/components/kanban-board/task-card.tsx
+++ b/apps/web/src/components/kanban-board/task-card.tsx
@@ -6,6 +6,7 @@ import {
Calendar,
CalendarClock,
CalendarX,
+ GitMerge,
GitPullRequest,
} from "lucide-react";
import { type CSSProperties, useMemo, useState } from "react";
@@ -21,6 +22,11 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
+import {
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from "@/components/ui/hover-card";
import { useDeleteTask } from "@/hooks/mutations/task/use-delete-task";
import useExternalLinks from "@/hooks/queries/external-link/use-external-links";
import useActiveWorkspace from "@/hooks/queries/workspace/use-active-workspace";
@@ -62,14 +68,38 @@ function TaskCard({ task }: TaskCardProps) {
const { mutateAsync: deleteTask } = useDeleteTask();
const { data: externalLinks } = useExternalLinks(task.id);
- const activePullRequest = useMemo(() => {
- if (!externalLinks) return null;
- return externalLinks.find(
- (link) =>
- link.resourceType === "pull_request" && link.metadata?.merged !== true,
- );
+ const pullRequests = useMemo(() => {
+ if (!externalLinks) return [];
+ return externalLinks.filter((link) => link.resourceType === "pull_request");
}, [externalLinks]);
+ const getPRInfo = (pr: (typeof pullRequests)[number]) => {
+ const isMerged = pr.metadata?.merged === true;
+ const isDraft = pr.metadata?.draft === true;
+
+ if (isMerged) {
+ return {
+ icon: <GitMerge className="h-3 w-3 text-purple-400" />,
+ status: "Merged",
+ statusClass: "text-purple-400",
+ };
+ }
+
+ if (isDraft) {
+ return {
+ icon: <GitPullRequest className="h-3 w-3 text-muted-foreground" />,
+ status: "Draft",
+ statusClass: "text-muted-foreground",
+ };
+ }
+
+ return {
+ icon: <GitPullRequest className="h-3 w-3 text-green-400" />,
+ status: "Open",
+ statusClass: "text-green-400",
+ };
+ };
+
const style: CSSProperties = {
transform: CSS.Transform.toString(transform),
transition:
@@ -210,20 +240,108 @@ function TaskCard({ task }: TaskCardProps) {
</div>
)}
- {activePullRequest && (
- <button
- type="button"
- onClick={(e) => {
- e.stopPropagation();
- window.open(activePullRequest.url, "_blank");
- }}
- className="inline-flex items-center gap-1 px-2 py-1 rounded border border-violet-200 bg-violet-50 text-[10px] font-medium text-violet-700 hover:bg-violet-100 hover:border-violet-300 transition-colors dark:bg-violet-950/50 dark:border-violet-800 dark:text-violet-300 dark:hover:bg-violet-900/50"
- title={activePullRequest.title || "Open Pull Request"}
- >
- <GitPullRequest className="w-3 h-3" />
- <span>#{activePullRequest.externalId}</span>
- </button>
+ {pullRequests.length === 1 && (
+ <HoverCard openDelay={200} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ window.open(pullRequests[0].url, "_blank");
+ }}
+ className="inline-flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-sidebar text-[10px] font-medium text-muted-foreground"
+ >
+ {getPRInfo(pullRequests[0]).icon}
+ <span>#{pullRequests[0].externalId}</span>
+ </button>
+ </HoverCardTrigger>
+ <HoverCardContent
+ className="w-72 p-3"
+ side="bottom"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <div className="space-y-2">
+ <div className="flex items-center gap-2 text-xs text-muted-foreground">
+ {getPRInfo(pullRequests[0]).icon}
+ <span>{getPRInfo(pullRequests[0]).status}</span>
+ <span className="text-muted-foreground/50">•</span>
+ <span>#{pullRequests[0].externalId}</span>
+ </div>
+ <p className="text-sm font-medium leading-snug">
+ {pullRequests[0].title || "Pull Request"}
+ </p>
+ </div>
+ </HoverCardContent>
+ </HoverCard>
)}
+
+ {pullRequests.length > 1 &&
+ (() => {
+ const hasOpen = pullRequests.some(
+ (pr) => !pr.metadata?.merged && !pr.metadata?.draft,
+ );
+ const allMerged = pullRequests.every(
+ (pr) => pr.metadata?.merged,
+ );
+ const iconColor = allMerged
+ ? "text-purple-400"
+ : hasOpen
+ ? "text-green-400"
+ : "text-muted-foreground";
+
+ return (
+ <HoverCard openDelay={200} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <button
+ type="button"
+ onClick={(e) => e.stopPropagation()}
+ className="inline-flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-sidebar text-[10px] font-medium text-muted-foreground"
+ >
+ <GitPullRequest className={`h-3 w-3 ${iconColor}`} />
+ <span>{pullRequests.length} PRs</span>
+ </button>
+ </HoverCardTrigger>
+ <HoverCardContent
+ className="w-auto min-w-56 max-w-96 p-1"
+ side="bottom"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {pullRequests.map((pr, index) => {
+ const prInfo = getPRInfo(pr);
+ const repoMatch = pr.url.match(
+ /github\.com\/([^/]+\/[^/]+)\/pull/,
+ );
+ const repoName = repoMatch ? repoMatch[1] : null;
+ return (
+ <div key={pr.id}>
+ {index > 0 && (
+ <hr className="border-border my-1" />
+ )}
+ <button
+ type="button"
+ onClick={() => window.open(pr.url, "_blank")}
+ className="w-full px-2 py-1.5 text-left hover:bg-muted/50 rounded transition-colors"
+ >
+ <div className="flex items-center gap-1.5 text-[11px] text-muted-foreground">
+ {prInfo.icon}
+ <span>
+ {repoName}#{pr.externalId}
+ </span>
+ </div>
+ <p className="text-xs leading-tight line-clamp-2 mt-0.5">
+ {pr.title || "Pull Request"}
+ </p>
+ <span className="text-[10px] text-muted-foreground">
+ {prInfo.status}
+ </span>
+ </button>
+ </div>
+ );
+ })}
+ </HoverCardContent>
+ </HoverCard>
+ );
+ })()}
</div>
</div>
</ContextMenuTrigger>
diff --git a/apps/web/src/components/ui/accordion.tsx b/apps/web/src/components/ui/accordion.tsx
new file mode 100644
index 000000000..a5271f1a7
--- /dev/null
+++ b/apps/web/src/components/ui/accordion.tsx
@@ -0,0 +1,55 @@
+import * as AccordionPrimitive from "@radix-ui/react-accordion";
+import { ChevronDown } from "lucide-react";
+import * as React from "react";
+
+import { cn } from "@/lib/cn";
+
+const Accordion = AccordionPrimitive.Root;
+
+const AccordionItem = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
+>(({ className, ...props }, ref) => (
+ <AccordionPrimitive.Item
+ ref={ref}
+ className={cn("border-b", className)}
+ {...props}
+ />
+));
+AccordionItem.displayName = "AccordionItem";
+
+const AccordionTrigger = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
+>(({ className, children, ...props }, ref) => (
+ <AccordionPrimitive.Header className="flex">
+ <AccordionPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" />
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+));
+AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
+
+const AccordionContent = React.forwardRef<
+ React.ElementRef<typeof AccordionPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
+>(({ className, children, ...props }, ref) => (
+ <AccordionPrimitive.Content
+ ref={ref}
+ className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
+ {...props}
+ >
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
+ </AccordionPrimitive.Content>
+));
+AccordionContent.displayName = AccordionPrimitive.Content.displayName;
+
+export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
index 907dbd97b..cc005e78a 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId_.tsx
@@ -4,16 +4,15 @@ import {
Calendar,
CalendarClock,
CalendarX,
- CircleDot,
Copy,
GitBranch,
- GitPullRequest,
Plus,
} from "lucide-react";
import { toast } from "sonner";
import Activity from "@/components/activity";
import CommentInput from "@/components/activity/comment-input";
import TaskLayout from "@/components/common/task-layout";
+import { ExternalLinksAccordion } from "@/components/external-links/external-links-accordion";
import PageTitle from "@/components/page-title";
import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
import TaskAssigneePopover from "@/components/task/task-assignee-popover";
@@ -327,73 +326,6 @@ function RouteComponent() {
)}
</div>
</div>
- {!isLoadingExternalLinks && (
- <div className="flex flex-col gap-1">
- <div className="flex items-center justify-between">
- <span className="text-xs font-medium text-muted-foreground pl-2">
- External Links
- </span>
- </div>
- <div className="flex flex-col gap-1.5 px-2">
- {externalLinks.length === 0 ? (
- <span className="text-xs text-muted-foreground/70 py-1">
- No linked resources
- </span>
- ) : (
- externalLinks.map((link) => {
- const isMerged = link.metadata?.merged === true;
- const isPR = link.resourceType === "pull_request";
- const isBranch = link.resourceType === "branch";
- const isIssue = link.resourceType === "issue";
-
- const getIcon = () => {
- if (isPR)
- return (
- <GitPullRequest
- className={`size-3.5 flex-shrink-0 ${isMerged ? "text-emerald-500" : "text-violet-500"}`}
- />
- );
- if (isBranch)
- return (
- <GitBranch className="size-3.5 flex-shrink-0 text-sky-500" />
- );
- return (
- <CircleDot className="size-3.5 flex-shrink-0 text-muted-foreground" />
- );
- };
-
- const getLabel = () => {
- if (link.title) return link.title;
- if (isPR) return `PR #${link.externalId}`;
- if (isIssue) return `Issue #${link.externalId}`;
- if (isBranch) return link.externalId;
- return link.externalId;
- };
-
- return (
- <a
- key={link.id}
- href={link.url}
- target="_blank"
- rel="noopener noreferrer"
- className="group flex items-center gap-2 py-1.5 px-2 -mx-2 rounded-md hover:bg-accent/50 transition-colors"
- >
- {getIcon()}
- <span className="text-xs truncate flex-1 text-foreground/80 group-hover:text-foreground">
- {getLabel()}
- </span>
- {isPR && isMerged && (
- <span className="text-[10px] font-medium text-emerald-500/80 bg-emerald-500/10 px-1.5 py-0.5 rounded">
- merged
- </span>
- )}
- </a>
- );
- })
- )}
- </div>
- </div>
- )}
</div>
</div>
}
@@ -408,6 +340,14 @@ function RouteComponent() {
</p>
<TaskTitle taskId={taskId} />
<TaskDescription taskId={taskId} />
+ {!isLoadingExternalLinks && externalLinks.length > 0 && (
+ <div className="mt-4">
+ <ExternalLinksAccordion
+ externalLinks={externalLinks}
+ isLoading={isLoadingExternalLinks}
+ />
+ </div>
+ )}
<span className="text-sm font-medium text-muted-foreground h-[1px] bg-border w-full" />
<div className="flex flex-col gap-4 pt-8">
<h1 className="text-md font-semibold">Activity</h1>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 014634d5c..6d994ee40 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -71,7 +71,7 @@ importers:
version: 6.0.0
better-auth:
specifier: ^1.4.7
croner:
specifier: ^9.1.0
version: 9.1.0
@@ -313,7 +313,7 @@ importers:
version: 19.0.0-beta-ebf51a3-20250411
better-auth:
specifier: ^1.4.5
class-variance-authority:
specifier: ^0.7.1
version: 0.7.1
@@ -9825,7 +9825,7 @@ snapshots:
dependencies: