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: complete task reminders and notifications (#1399)

Tin Sever813dcb363164
diff --git a/.claude/skills/verify/SKILL.md b/.claude/skills/verify/SKILL.md
new file mode 100644
index 000000000..b1f33e80a
--- /dev/null
+++ b/.claude/skills/verify/SKILL.md
@@ -0,0 +1,25 @@
+---
+name: verify
+description: Build/launch/drive recipe for verifying Kaneo changes end-to-end on a local dev instance
+---
+
+# Verifying Kaneo changes
+
+## Launch
+
+- `pnpm dev` starts API (1337) and web (5173). Check `lsof -nP -iTCP:1337 -sTCP:LISTEN` first; the user often already has both running.
+- API is `tsx watch` — it hot-restarts on any imported .ts change, but NOT on `apps/api/drizzle/*.sql` changes (manual restart needed after editing migrations).
+- Migrations auto-run on API startup; a failed migration exits the process (port goes dead).
+
+## Database access
+
+- `DATABASE_URL=$(grep "^DATABASE_URL" .env | cut -d= -f2-); psql "$DATABASE_URL"` — direct Postgres access for asserting rows (notification, task_reminder_sent, user_notification_preference).
+- Gotcha: `task.userId` in Drizzle maps to column `assignee_id`, not `user_id`.
+- When replicating scheduler SQL by hand, `SET timezone = 'UTC'` first; timestamps are naive UTC.
+
+## Driving flows
+
+- Drive the web UI at localhost:5173 with claude-in-chrome; the user's session is usually signed in.
+- Notification bell is top-left next to the workspace switcher; badge updates live over websocket (no refresh needed to observe delivery).
+- Due-date picker is date-only (stores local midnight as naive UTC). To trigger the due-date reminder cron (every 5 min, 10-min lookback window) within a session: set the assignee's lead-time preference (Settings > Account > Notifications, in hours) or nudge `task.due_date` via psql so `due_date - lead` lands 2-3 min ahead.
+- Preferences save button silently disables for out-of-range lead values.
diff --git a/apps/api/drizzle/0033_public_patriot.sql b/apps/api/drizzle/0033_public_patriot.sql
new file mode 100644
index 000000000..90d029e3c
--- /dev/null
+++ b/apps/api/drizzle/0033_public_patriot.sql
@@ -0,0 +1,5 @@
+ALTER TABLE "user_notification_preference" ADD COLUMN IF NOT EXISTS "task_assignment_enabled" boolean DEFAULT true NOT NULL;--> statement-breakpoint
+ALTER TABLE "user_notification_preference" ADD COLUMN IF NOT EXISTS "task_comment_enabled" boolean DEFAULT true NOT NULL;--> statement-breakpoint
+ALTER TABLE "user_notification_preference" ADD COLUMN IF NOT EXISTS "task_status_change_enabled" boolean DEFAULT true NOT NULL;--> statement-breakpoint
+ALTER TABLE "user_notification_preference" ADD COLUMN IF NOT EXISTS "due_date_reminder_enabled" boolean DEFAULT true NOT NULL;--> statement-breakpoint
+ALTER TABLE "user_notification_preference" ADD COLUMN IF NOT EXISTS "due_date_reminder_lead_time_minutes" integer DEFAULT 1440 NOT NULL;
diff --git a/apps/api/drizzle/meta/0033_snapshot.json b/apps/api/drizzle/meta/0033_snapshot.json
new file mode 100644
index 000000000..d42044ce3
--- /dev/null
+++ b/apps/api/drizzle/meta/0033_snapshot.json
@@ -0,0 +1,3635 @@
+{
+ "id": "3476a0a5-b497-4ecd-a6ba-c952266ce668",
+ "prevId": "e63564e4-43c0-4608-abd6-80fbbeb83677",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event_data": {
+ "name": "event_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_name": {
+ "name": "external_user_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_user_avatar": {
+ "name": "external_user_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_source": {
+ "name": "external_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_url": {
+ "name": "external_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "activity_task_id_idx": {
+ "name": "activity_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "activity_userId_idx": {
+ "name": "activity_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "activity_task_external_source_external_url_unique": {
+ "name": "activity_task_external_source_external_url_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "external_source", "external_url"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 86400000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 10
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_userId_idx": {
+ "name": "apikey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "apikey_reference_id_user_id_fk": {
+ "name": "apikey_reference_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["reference_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "apikey_user_id_user_id_fk": {
+ "name": "apikey_user_id_user_id_fk",
+ "tableFrom": "apikey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.asset": {
+ "name": "asset",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activity_id": {
+ "name": "activity_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "object_key": {
+ "name": "object_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mime_type": {
+ "name": "mime_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'image'"
+ },
+ "surface": {
+ "name": "surface",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'description'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "asset_workspaceId_idx": {
+ "name": "asset_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_projectId_idx": {
+ "name": "asset_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_taskId_idx": {
+ "name": "asset_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_activityId_idx": {
+ "name": "asset_activityId_idx",
+ "columns": [
+ {
+ "expression": "activity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "asset_createdBy_idx": {
+ "name": "asset_createdBy_idx",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "asset_workspace_id_workspace_id_fk": {
+ "name": "asset_workspace_id_workspace_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_project_id_project_id_fk": {
+ "name": "asset_project_id_project_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_task_id_task_id_fk": {
+ "name": "asset_task_id_task_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_activity_id_activity_id_fk": {
+ "name": "asset_activity_id_activity_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "activity",
+ "columnsFrom": ["activity_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "asset_created_by_user_id_fk": {
+ "name": "asset_created_by_user_id_fk",
+ "tableFrom": "asset",
+ "tableTo": "user",
+ "columnsFrom": ["created_by"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "asset_object_key_unique": {
+ "name": "asset_object_key_unique",
+ "nullsNotDistinct": false,
+ "columns": ["object_key"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.column": {
+ "name": "column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_final": {
+ "name": "is_final",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "column_projectId_idx": {
+ "name": "column_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "column_project_id_project_id_fk": {
+ "name": "column_project_id_project_id_fk",
+ "tableFrom": "column",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.comment": {
+ "name": "comment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "comment_task_idx": {
+ "name": "comment_task_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "comment_user_idx": {
+ "name": "comment_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "comment_task_id_task_id_fk": {
+ "name": "comment_task_id_task_id_fk",
+ "tableFrom": "comment",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "comment_user_id_user_id_fk": {
+ "name": "comment_user_id_user_id_fk",
+ "tableFrom": "comment",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.device_code": {
+ "name": "device_code",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "device_code": {
+ "name": "device_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_code": {
+ "name": "user_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_polled_at": {
+ "name": "last_polled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "polling_interval": {
+ "name": "polling_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "device_code_device_code_uidx": {
+ "name": "device_code_device_code_uidx",
+ "columns": [
+ {
+ "expression": "device_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_code_user_code_uidx": {
+ "name": "device_code_user_code_uidx",
+ "columns": [
+ {
+ "expression": "user_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "device_code_user_id_idx": {
+ "name": "device_code_user_id_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "device_code_user_id_user_id_fk": {
+ "name": "device_code_user_id_user_id_fk",
+ "tableFrom": "device_code",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.external_link": {
+ "name": "external_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": 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": {
+ "integration_project_type_unique": {
+ "name": "integration_project_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id", "type"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_workspaceId_idx": {
+ "name": "invitation_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_inviterId_idx": {
+ "name": "invitation_inviterId_idx",
+ "columns": [
+ {
+ "expression": "inviter_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "label_task_id_idx": {
+ "name": "label_task_id_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "label_workspace_id_idx": {
+ "name": "label_workspace_id_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "label_workspace_name_unique": {
+ "name": "label_workspace_name_unique",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"label\".\"task_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_task_name_unique": {
+ "name": "label_task_name_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "name"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "event_data": {
+ "name": "event_data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resource_type": {
+ "name": "resource_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_userId_idx": {
+ "name": "notification_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_role": {
+ "name": "workspace_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_role_workspaceId_idx": {
+ "name": "workspace_role_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_role_role_idx": {
+ "name": "workspace_role_role_idx",
+ "columns": [
+ {
+ "expression": "role",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_role_workspace_id_workspace_id_fk": {
+ "name": "workspace_role_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_role",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "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": {
+ "project_workspace_id_id_unique": {
+ "name": "project_workspace_id_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id", "id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_relation": {
+ "name": "task_relation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_task_id": {
+ "name": "source_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_task_id": {
+ "name": "target_task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "relation_type": {
+ "name": "relation_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_relation_source_idx": {
+ "name": "task_relation_source_idx",
+ "columns": [
+ {
+ "expression": "source_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_relation_target_idx": {
+ "name": "task_relation_target_idx",
+ "columns": [
+ {
+ "expression": "target_task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_relation_source_task_id_task_id_fk": {
+ "name": "task_relation_source_task_id_task_id_fk",
+ "tableFrom": "task_relation",
+ "tableTo": "task",
+ "columnsFrom": ["source_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_relation_target_task_id_task_id_fk": {
+ "name": "task_relation_target_task_id_task_id_fk",
+ "tableFrom": "task_relation",
+ "tableTo": "task",
+ "columnsFrom": ["target_task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_reminder_sent": {
+ "name": "task_reminder_sent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reminder_type": {
+ "name": "reminder_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_reminder_sent_taskId_idx": {
+ "name": "task_reminder_sent_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_reminder_sent_task_id_task_id_fk": {
+ "name": "task_reminder_sent_task_id_task_id_fk",
+ "tableFrom": "task_reminder_sent",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_reminder_sent_task_type_unique": {
+ "name": "task_reminder_sent_task_type_unique",
+ "nullsNotDistinct": false,
+ "columns": ["task_id", "reminder_type"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task": {
+ "name": "task",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'to-do'"
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'low'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "task_projectId_idx": {
+ "name": "task_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_dueDate_idx": {
+ "name": "task_dueDate_idx",
+ "columns": [
+ {
+ "expression": "due_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_assigneeId_idx": {
+ "name": "task_assigneeId_idx",
+ "columns": [
+ {
+ "expression": "assignee_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "task_columnId_idx": {
+ "name": "task_columnId_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_column_id_column_id_fk": {
+ "name": "task_column_id_column_id_fk",
+ "tableFrom": "task",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "task_project_number_unique": {
+ "name": "task_project_number_unique",
+ "nullsNotDistinct": false,
+ "columns": ["project_id", "number"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_workspaceId_idx": {
+ "name": "team_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "teamMember_teamId_idx": {
+ "name": "teamMember_teamId_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "teamMember_userId_idx": {
+ "name": "teamMember_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": ["team_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.time_entry": {
+ "name": "time_entry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration": {
+ "name": "duration",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "time_entry_taskId_idx": {
+ "name": "time_entry_taskId_idx",
+ "columns": [
+ {
+ "expression": "task_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "time_entry_userId_idx": {
+ "name": "time_entry_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "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
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_anonymous": {
+ "name": "is_anonymous",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "banned": {
+ "name": "banned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "ban_reason": {
+ "name": "ban_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ban_expires": {
+ "name": "ban_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": ["email"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_enabled": {
+ "name": "email_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_enabled": {
+ "name": "ntfy_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_server_url": {
+ "name": "ntfy_server_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ntfy_topic": {
+ "name": "ntfy_topic",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ntfy_token": {
+ "name": "ntfy_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gotify_enabled": {
+ "name": "gotify_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "gotify_server_url": {
+ "name": "gotify_server_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gotify_token": {
+ "name": "gotify_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_enabled": {
+ "name": "webhook_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "webhook_url": {
+ "name": "webhook_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_secret": {
+ "name": "webhook_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "task_assignment_enabled": {
+ "name": "task_assignment_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "task_comment_enabled": {
+ "name": "task_comment_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "task_status_change_enabled": {
+ "name": "task_status_change_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "due_date_reminder_enabled": {
+ "name": "due_date_reminder_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "due_date_reminder_lead_time_minutes": {
+ "name": "due_date_reminder_lead_time_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1440
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_preference_user_id_unique": {
+ "name": "user_notification_preference_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_workspace_project": {
+ "name": "user_notification_workspace_project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_rule_id": {
+ "name": "workspace_rule_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_notification_workspace_project_ruleId_idx": {
+ "name": "user_notification_workspace_project_ruleId_idx",
+ "columns": [
+ {
+ "expression": "workspace_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_project_projectId_idx": {
+ "name": "user_notification_workspace_project_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_project_workspaceId_projectId_idx": {
+ "name": "user_notification_workspace_project_workspaceId_projectId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "unwp_workspaceId_workspaceRuleId_idx": {
+ "name": "unwp_workspaceId_workspaceRuleId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "workspace_rule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_notification_workspace_project_workspace_id_workspace_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_workspace_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_workspace_rule_id_user_notification_workspace_rule_workspace_id_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "user_notification_workspace_rule",
+ "columnsFrom": ["workspace_id", "workspace_rule_id"],
+ "columnsTo": ["workspace_id", "id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk": {
+ "name": "user_notification_workspace_project_workspace_id_project_id_project_workspace_id_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "project",
+ "columnsFrom": ["workspace_id", "project_id"],
+ "columnsTo": ["workspace_id", "id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_workspace_project_rule_project_unique": {
+ "name": "user_notification_workspace_project_rule_project_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_rule_id", "project_id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_workspace_rule": {
+ "name": "user_notification_workspace_rule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "email_enabled": {
+ "name": "email_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "ntfy_enabled": {
+ "name": "ntfy_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "gotify_enabled": {
+ "name": "gotify_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "webhook_enabled": {
+ "name": "webhook_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "project_mode": {
+ "name": "project_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'all'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_notification_workspace_rule_userId_idx": {
+ "name": "user_notification_workspace_rule_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_notification_workspace_rule_workspaceId_idx": {
+ "name": "user_notification_workspace_rule_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_notification_workspace_rule_user_id_user_id_fk": {
+ "name": "user_notification_workspace_rule_user_id_user_id_fk",
+ "tableFrom": "user_notification_workspace_rule",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_rule_workspace_id_workspace_id_fk": {
+ "name": "user_notification_workspace_rule_workspace_id_workspace_id_fk",
+ "tableFrom": "user_notification_workspace_rule",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_workspace_rule_user_workspace_unique": {
+ "name": "user_notification_workspace_rule_user_workspace_unique",
+ "nullsNotDistinct": false,
+ "columns": ["user_id", "workspace_id"]
+ },
+ "user_notification_workspace_rule_workspace_id_id_unique": {
+ "name": "user_notification_workspace_rule_workspace_id_id_unique",
+ "nullsNotDistinct": false,
+ "columns": ["workspace_id", "id"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_rule": {
+ "name": "workflow_rule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_type": {
+ "name": "integration_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_rule_projectId_idx": {
+ "name": "workflow_rule_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workflow_rule_columnId_idx": {
+ "name": "workflow_rule_columnId_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_rule_project_id_project_id_fk": {
+ "name": "workflow_rule_project_id_project_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "workflow_rule_column_id_column_id_fk": {
+ "name": "workflow_rule_column_id_column_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_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 f4f1b78e8..9caa9391a 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -232,6 +232,13 @@
"when": 1783761933880,
"tag": "0032_unify_task_comments",
"breakpoints": true
+ },
+ {
+ "idx": 33,
+ "version": "7",
+ "when": 1784374645880,
+ "tag": "0033_public_patriot",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/activity/controllers/create-comment.ts b/apps/api/src/activity/controllers/create-comment.ts
index a3c71a305..035a6a728 100644
--- a/apps/api/src/activity/controllers/create-comment.ts
+++ b/apps/api/src/activity/controllers/create-comment.ts
@@ -1,7 +1,12 @@
import { eq } from "drizzle-orm";
import { HTTPException } from "hono/http-exception";
import db from "../../database";
-import { activityTable, taskTable, userTable } from "../../database/schema";
+import {
+ activityTable,
+ projectTable,
+ taskTable,
+ userTable,
+} from "../../database/schema";
import { publishEvent } from "../../events";
import createNotification from "../../notification/controllers/create-notification";
import { parseMentionIds } from "../../utils/parse-mentions";
@@ -29,8 +34,14 @@ async function createComment(taskId: string, userId: string, content: string) {
.where(eq(userTable.id, userId));
const [task] = await db
- .select({ projectId: taskTable.projectId, title: taskTable.title })
+ .select({
+ assigneeId: taskTable.userId,
+ projectId: taskTable.projectId,
+ title: taskTable.title,
+ workspaceId: projectTable.workspaceId,
+ })
.from(taskTable)
+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
.where(eq(taskTable.id, taskId));
if (task) {
@@ -50,6 +61,28 @@ async function createComment(taskId: string, userId: string, content: string) {
eventData: {
taskTitle: task?.title ?? null,
mentionerName: user?.name ?? null,
+ projectId: task?.projectId ?? null,
+ workspaceId: task?.workspaceId ?? null,
+ },
+ resourceId: taskId,
+ resourceType: "task",
+ });
+ }
+
+ if (
+ task?.assigneeId &&
+ task.assigneeId !== userId &&
+ !mentionedIds.includes(task.assigneeId)
+ ) {
+ await createNotification({
+ userId: task.assigneeId,
+ type: "task_comment",
+ eventData: {
+ taskTitle: task.title,
+ commenterName: user?.name ?? null,
+ commentPreview: content.slice(0, 160),
+ projectId: task.projectId,
+ workspaceId: task.workspaceId,
},
resourceId: taskId,
resourceType: "task",
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 9566d1f74..030d2c539 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -589,6 +589,21 @@ export const userNotificationPreferenceTable = pgTable(
webhookEnabled: boolean("webhook_enabled").default(false).notNull(),
webhookUrl: text("webhook_url"),
webhookSecret: text("webhook_secret"),
+ taskAssignmentEnabled: boolean("task_assignment_enabled")
+ .default(true)
+ .notNull(),
+ taskCommentEnabled: boolean("task_comment_enabled").default(true).notNull(),
+ taskStatusChangeEnabled: boolean("task_status_change_enabled")
+ .default(true)
+ .notNull(),
+ dueDateReminderEnabled: boolean("due_date_reminder_enabled")
+ .default(true)
+ .notNull(),
+ dueDateReminderLeadTimeMinutes: integer(
+ "due_date_reminder_lead_time_minutes",
+ )
+ .default(1440)
+ .notNull(),
createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
updatedAt: timestamp("updated_at", { mode: "date" })
.defaultNow()
diff --git a/apps/api/src/generic-webhook-integration/index.ts b/apps/api/src/generic-webhook-integration/index.ts
index 133c94bf9..c881be6e5 100644
--- a/apps/api/src/generic-webhook-integration/index.ts
+++ b/apps/api/src/generic-webhook-integration/index.ts
@@ -55,6 +55,8 @@ function toResponse(integration: {
...defaultGenericWebhookEvents,
...(config.events ?? {}),
},
+ dueDateReminderLeadTimeMinutes:
+ config.dueDateReminderLeadTimeMinutes ?? 1440,
isActive: integration.isActive,
createdAt: integration.createdAt,
updatedAt: integration.updatedAt,
@@ -83,6 +85,7 @@ const genericWebhookEventsSchema = v.object({
taskTitleChanged: v.optional(v.boolean()),
taskDescriptionChanged: v.optional(v.boolean()),
taskCommentCreated: v.optional(v.boolean()),
+ dueDateReminder: v.optional(v.boolean()),
});
const nullableGenericWebhookIntegrationSchema = v.nullable(
@@ -138,6 +141,9 @@ genericWebhookIntegration
webhookUrl: v.pipe(v.string(), v.minLength(1)),
secret: v.optional(v.string()),
events: v.optional(genericWebhookEventsSchema),
+ dueDateReminderLeadTimeMinutes: v.optional(
+ v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),
+ ),
}),
),
workspaceAccess.fromProject("projectId"),
@@ -150,6 +156,7 @@ genericWebhookIntegration
webhookUrl: body.webhookUrl,
secret: body.secret,
events: body.events,
+ dueDateReminderLeadTimeMinutes: body.dueDateReminderLeadTimeMinutes,
});
const validation = await validateGenericWebhookConfig(config);
@@ -212,6 +219,9 @@ genericWebhookIntegration
secret: v.optional(v.nullable(v.string())),
isActive: v.optional(v.boolean()),
events: v.optional(genericWebhookEventsSchema),
+ dueDateReminderLeadTimeMinutes: v.optional(
+ v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),
+ ),
}),
),
workspaceAccess.fromProject("projectId"),
@@ -246,6 +256,9 @@ genericWebhookIntegration
...(currentConfig.events ?? {}),
...(body.events ?? {}),
},
+ dueDateReminderLeadTimeMinutes:
+ body.dueDateReminderLeadTimeMinutes ??
+ currentConfig.dueDateReminderLeadTimeMinutes,
});
const validation = await validateGenericWebhookConfig(nextConfig);
diff --git a/apps/api/src/notification-preferences/delivery.ts b/apps/api/src/notification-preferences/delivery.ts
index b5c727eb5..9f3fbff50 100644
--- a/apps/api/src/notification-preferences/delivery.ts
+++ b/apps/api/src/notification-preferences/delivery.ts
@@ -59,6 +59,27 @@ function getStringValue(
return typeof value === "string" ? value : null;
}
+function getNumberValue(
+ data: Record<string, unknown> | null | undefined,
+ key: string,
+) {
+ const value = data?.[key];
+ return typeof value === "number" ? value : null;
+}
+
+function formatLeadTime(minutes: number | null) {
+ if (!minutes) return "soon";
+ if (minutes % 1440 === 0) {
+ const days = minutes / 1440;
+ return `in ${days} ${days === 1 ? "day" : "days"}`;
+ }
+ if (minutes % 60 === 0) {
+ const hours = minutes / 60;
+ return `in ${hours} ${hours === 1 ? "hour" : "hours"}`;
+ }
+ return `in ${minutes} minutes`;
+}
+
function buildDeliveryContent(notification: {
type: string;
content: string | null;
@@ -126,12 +147,9 @@ function buildDeliveryContent(notification: {
}
case "due_date_reminder": {
const taskTitle = getStringValue(notification.eventData, "taskTitle");
- const reminderType = getStringValue(
- notification.eventData,
- "reminderType",
+ const label = formatLeadTime(
+ getNumberValue(notification.eventData, "leadTimeMinutes"),
);
- const label =
- reminderType === "one_hour_before" ? "in 1 hour" : "in 1 day";
return {
title: "Task due soon",
body: taskTitle
@@ -148,6 +166,36 @@ function buildDeliveryContent(notification: {
: "A task is past its due date.",
};
}
+ case "task_mention": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ const mentionerName = getStringValue(
+ notification.eventData,
+ "mentionerName",
+ );
+ return {
+ title: mentionerName
+ ? `${mentionerName} mentioned you`
+ : "You were mentioned",
+ body: taskTitle
+ ? `You were mentioned in ${taskTitle}.`
+ : "You were mentioned in a Kaneo task.",
+ };
+ }
+ case "task_comment": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ const commenterName = getStringValue(
+ notification.eventData,
+ "commenterName",
+ );
+ return {
+ title: commenterName
+ ? `${commenterName} commented on your task`
+ : "New task comment",
+ body: taskTitle
+ ? `A new comment was added to ${taskTitle}.`
+ : "A new comment was added to a Kaneo task.",
+ };
+ }
default:
return {
title: notification.title ?? "New Kaneo notification",
@@ -465,7 +513,7 @@ export async function deliverNotification(
actionUrl: context.taskUrl,
actionLabel: context.taskUrl ? "Open in Kaneo" : undefined,
locale: user.locale ?? null,
- }),
+ }).then(() => undefined),
);
}
diff --git a/apps/api/src/notification-preferences/index.ts b/apps/api/src/notification-preferences/index.ts
index 00be494d5..b3c49563d 100644
--- a/apps/api/src/notification-preferences/index.ts
+++ b/apps/api/src/notification-preferences/index.ts
@@ -121,6 +121,13 @@ notificationPreferences
webhookEnabled: v.optional(v.boolean()),
webhookUrl: v.optional(v.nullable(v.string())),
webhookSecret: v.optional(v.nullable(v.string())),
+ taskAssignmentEnabled: v.optional(v.boolean()),
+ taskCommentEnabled: v.optional(v.boolean()),
+ taskStatusChangeEnabled: v.optional(v.boolean()),
+ dueDateReminderEnabled: v.optional(v.boolean()),
+ dueDateReminderLeadTimeMinutes: v.optional(
+ v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),
+ ),
}),
),
async (c) => {
diff --git a/apps/api/src/notification-preferences/service.ts b/apps/api/src/notification-preferences/service.ts
index 15c1ece6e..767be8695 100644
--- a/apps/api/src/notification-preferences/service.ts
+++ b/apps/api/src/notification-preferences/service.ts
@@ -32,6 +32,11 @@ export type NotificationPreferenceResponse = {
webhookUrl: string | null;
webhookSecretConfigured: boolean;
maskedWebhookSecret: string | null;
+ taskAssignmentEnabled: boolean;
+ taskCommentEnabled: boolean;
+ taskStatusChangeEnabled: boolean;
+ dueDateReminderEnabled: boolean;
+ dueDateReminderLeadTimeMinutes: number;
workspaces: Array<{
id: string;
workspaceId: string;
@@ -62,6 +67,11 @@ export type UpdateNotificationPreferenceInput = {
webhookEnabled?: boolean;
webhookUrl?: string | null;
webhookSecret?: string | null;
+ taskAssignmentEnabled?: boolean;
+ taskCommentEnabled?: boolean;
+ taskStatusChangeEnabled?: boolean;
+ dueDateReminderEnabled?: boolean;
+ dueDateReminderLeadTimeMinutes?: number;
};
export type UpsertWorkspaceRuleInput = {
@@ -201,6 +211,12 @@ export async function getNotificationPreferences(
webhookUrl: decryptedPreference?.webhookUrl ?? null,
webhookSecretConfigured: Boolean(decryptedPreference?.webhookSecret),
maskedWebhookSecret: maskValue(decryptedPreference?.webhookSecret),
+ taskAssignmentEnabled: preference?.taskAssignmentEnabled ?? true,
+ taskCommentEnabled: preference?.taskCommentEnabled ?? true,
+ taskStatusChangeEnabled: preference?.taskStatusChangeEnabled ?? true,
+ dueDateReminderEnabled: preference?.dueDateReminderEnabled ?? true,
+ dueDateReminderLeadTimeMinutes:
+ preference?.dueDateReminderLeadTimeMinutes ?? 1440,
workspaces: rules.map((rule) => ({
id: rule.id,
workspaceId: rule.workspaceId,
@@ -379,6 +395,20 @@ export async function updateNotificationPreferences(
input.webhookSecret === undefined
? (existing?.webhookSecret ?? null)
: (encryptSecret(webhookSecret) ?? null),
+ taskAssignmentEnabled:
+ input.taskAssignmentEnabled ?? existing?.taskAssignmentEnabled ?? true,
+ taskCommentEnabled:
+ input.taskCommentEnabled ?? existing?.taskCommentEnabled ?? true,
+ taskStatusChangeEnabled:
+ input.taskStatusChangeEnabled ??
+ existing?.taskStatusChangeEnabled ??
+ true,
+ dueDateReminderEnabled:
+ input.dueDateReminderEnabled ?? existing?.dueDateReminderEnabled ?? true,
+ dueDateReminderLeadTimeMinutes:
+ input.dueDateReminderLeadTimeMinutes ??
+ existing?.dueDateReminderLeadTimeMinutes ??
+ 1440,
};
if (existing) {
diff --git a/apps/api/src/notification/controllers/create-notification.ts b/apps/api/src/notification/controllers/create-notification.ts
index a8de26cb0..91e25a19e 100644
--- a/apps/api/src/notification/controllers/create-notification.ts
+++ b/apps/api/src/notification/controllers/create-notification.ts
@@ -21,6 +21,29 @@ async function createNotification({
resourceId?: string;
resourceType?: string;
}) {
+ const preferenceKey =
+ type === "task_assignee_changed" || type === "task_created"
+ ? "taskAssignmentEnabled"
+ : type === "task_comment" || type === "task_mention"
+ ? "taskCommentEnabled"
+ : type === "task_status_changed"
+ ? "taskStatusChangeEnabled"
+ : type === "due_date_reminder" || type === "task_overdue"
+ ? "dueDateReminderEnabled"
+ : null;
+
+ if (preferenceKey) {
+ const preference = await db.query.userNotificationPreferenceTable.findFirst(
+ {
+ where: (table, { eq }) => eq(table.userId, userId),
+ },
+ );
+
+ if (preference?.[preferenceKey] === false) {
+ return null;
+ }
+ }
+
const [notification] = await db
.insert(notificationTable)
.values({
diff --git a/apps/api/src/notification/index.ts b/apps/api/src/notification/index.ts
index 29515cb91..51962f2a0 100644
--- a/apps/api/src/notification/index.ts
+++ b/apps/api/src/notification/index.ts
@@ -162,10 +162,11 @@ const notification = new Hono<{
subscribeToEvent<{
taskId: string;
userId: string;
+ currentUserId?: string;
title: string;
projectId: string;
}>("task.created", async (data) => {
- if (data.userId) {
+ if (data.userId && data.userId !== data.currentUserId) {
const [project] = await db
.select({ workspaceId: projectTable.workspaceId })
.from(projectTable)
diff --git a/apps/api/src/plugins/generic-webhook/config.ts b/apps/api/src/plugins/generic-webhook/config.ts
index e77e81858..177648c31 100644
--- a/apps/api/src/plugins/generic-webhook/config.ts
+++ b/apps/api/src/plugins/generic-webhook/config.ts
@@ -95,6 +95,7 @@ export const genericWebhookEventKeys = [
"taskTitleChanged",
"taskDescriptionChanged",
"taskCommentCreated",
+ "dueDateReminder",
] as const;
export type GenericWebhookEventKey = (typeof genericWebhookEventKeys)[number];
@@ -133,8 +134,12 @@ export const genericWebhookConfigSchema = v.object({
taskTitleChanged: v.optional(v.boolean()),
taskDescriptionChanged: v.optional(v.boolean()),
taskCommentCreated: v.optional(v.boolean()),
+ dueDateReminder: v.optional(v.boolean()),
}),
),
+ dueDateReminderLeadTimeMinutes: v.optional(
+ v.pipe(v.number(), v.integer(), v.minValue(5), v.maxValue(43_200)),
+ ),
});
export type GenericWebhookConfig = v.InferOutput<
@@ -151,6 +156,7 @@ export const defaultGenericWebhookEvents: Record<
taskTitleChanged: false,
taskDescriptionChanged: false,
taskCommentCreated: true,
+ dueDateReminder: false,
};
export function normalizeGenericWebhookConfig(
@@ -170,6 +176,8 @@ export function normalizeGenericWebhookConfig(
failureCount: config.health.failureCount ?? 0,
}
: undefined,
+ dueDateReminderLeadTimeMinutes:
+ config.dueDateReminderLeadTimeMinutes ?? 1440,
events: {
...defaultGenericWebhookEvents,
...(config.events ?? {}),
diff --git a/apps/api/src/plugins/generic-webhook/events.ts b/apps/api/src/plugins/generic-webhook/events.ts
index 98481342f..6a5d92266 100644
--- a/apps/api/src/plugins/generic-webhook/events.ts
+++ b/apps/api/src/plugins/generic-webhook/events.ts
@@ -149,9 +149,9 @@ async function sendEvent(
projectId: string,
userId: string | null,
data: Record<string, unknown>,
-): Promise<void> {
+): Promise<boolean> {
const task = await getTaskData(taskId, projectId);
- if (!task) return;
+ if (!task) return false;
const actor = await getActor(userId);
const attempt = {
@@ -199,6 +199,7 @@ async function sendEvent(
lastAttempt: attempt,
},
}));
+ return true;
} catch (error) {
const message =
error instanceof Error ? (error.stack ?? error.message) : String(error);
@@ -221,9 +222,33 @@ async function sendEvent(
projectId,
webhookUrl: config.webhookUrl,
});
+ return false;
}
}
+export async function sendDueDateReminder(
+ config: GenericWebhookConfig,
+ taskId: string,
+ projectId: string,
+ leadTimeMinutes: number,
+ dueDate: Date,
+): Promise<boolean> {
+ const normalizedConfig = normalizeGenericWebhookConfig(config);
+ if (!isEnabled(normalizedConfig, "dueDateReminder")) return false;
+
+ return sendEvent(
+ normalizedConfig,
+ "task.due_date_reminder",
+ taskId,
+ projectId,
+ null,
+ {
+ dueDate: dueDate.toISOString(),
+ leadTimeMinutes,
+ },
+ );
+}
+
export async function handleTaskCreated(
event: TaskCreatedEvent,
context: PluginContext,
diff --git a/apps/api/src/scheduler/due-date-reminders.ts b/apps/api/src/scheduler/due-date-reminders.ts
index cdd1fdb88..1a673d2a6 100644
--- a/apps/api/src/scheduler/due-date-reminders.ts
+++ b/apps/api/src/scheduler/due-date-reminders.ts
@@ -1,31 +1,26 @@
-import { and, between, eq, isNotNull, isNull, or } from "drizzle-orm";
+import { and, between, eq, isNotNull, isNull, or, sql } from "drizzle-orm";
import db from "../database";
import {
columnTable,
taskReminderSentTable,
taskTable,
+ userNotificationPreferenceTable,
} from "../database/schema";
import createNotification from "../notification/controllers/create-notification";
+import { REMINDER_WINDOW_MINUTES } from "./reminder-timing";
-type ReminderType = "one_day_before" | "one_hour_before" | "overdue";
+type ReminderType = "configured_before" | "overdue";
-const HOUR_MS = 60 * 60 * 1000;
const MINUTE_MS = 60 * 1000;
function buildWindows(now: Date) {
const nowMs = now.getTime();
return {
- oneDay: {
- start: new Date(nowMs + 23 * HOUR_MS + 50 * MINUTE_MS),
- end: new Date(nowMs + 24 * HOUR_MS + 10 * MINUTE_MS),
- type: "one_day_before" as ReminderType,
- notificationType: "due_date_reminder" as const,
- },
- oneHour: {
- start: new Date(nowMs + 50 * MINUTE_MS),
- end: new Date(nowMs + 70 * MINUTE_MS),
- type: "one_hour_before" as ReminderType,
+ upcoming: {
+ start: new Date(nowMs - REMINDER_WINDOW_MINUTES * MINUTE_MS),
+ end: now,
+ type: "configured_before" as ReminderType,
notificationType: "due_date_reminder" as const,
},
overdue: {
@@ -49,9 +44,15 @@ async function getTasksNeedingReminder(
userId: taskTable.userId,
dueDate: taskTable.dueDate,
projectId: taskTable.projectId,
+ leadTimeMinutes:
+ userNotificationPreferenceTable.dueDateReminderLeadTimeMinutes,
})
.from(taskTable)
.leftJoin(columnTable, eq(taskTable.columnId, columnTable.id))
+ .leftJoin(
+ userNotificationPreferenceTable,
+ eq(userNotificationPreferenceTable.userId, taskTable.userId),
+ )
.leftJoin(
taskReminderSentTable,
and(
@@ -63,8 +64,14 @@ async function getTasksNeedingReminder(
and(
isNotNull(taskTable.userId),
isNotNull(taskTable.dueDate),
- between(taskTable.dueDate, windowStart, windowEnd),
+ reminderType === "configured_before"
+ ? sql`${taskTable.dueDate} - (COALESCE(${userNotificationPreferenceTable.dueDateReminderLeadTimeMinutes}, 1440) * interval '1 minute') BETWEEN ${windowStart.toISOString()} AND ${windowEnd.toISOString()}`
+ : between(taskTable.dueDate, windowStart, windowEnd),
isNull(taskReminderSentTable.id),
+ or(
+ isNull(userNotificationPreferenceTable.id),
+ eq(userNotificationPreferenceTable.dueDateReminderEnabled, true),
+ ),
// Exclude tasks in final columns (completed); include tasks with no column
or(isNull(columnTable.isFinal), eq(columnTable.isFinal, false)),
),
@@ -80,6 +87,7 @@ async function processReminder(
userId: string | null;
dueDate: Date | null;
projectId: string;
+ leadTimeMinutes: number | null;
},
reminderType: ReminderType,
notificationType: "due_date_reminder" | "task_overdue",
@@ -103,7 +111,12 @@ async function processReminder(
.returning();
if (!inserted) return;
- } catch {
+ } catch (error) {
+ console.error("Failed to record due date reminder", {
+ taskId: task.id,
+ reminderType,
+ error,
+ });
return;
}
@@ -113,6 +126,7 @@ async function processReminder(
eventData: {
taskTitle: task.title,
reminderType,
+ leadTimeMinutes: task.leadTimeMinutes ?? 1440,
dueDate: task.dueDate?.toISOString() ?? null,
},
resourceId: task.id,
diff --git a/apps/api/src/scheduler/index.ts b/apps/api/src/scheduler/index.ts
index f085b67ef..d7afb4f8e 100644
--- a/apps/api/src/scheduler/index.ts
+++ b/apps/api/src/scheduler/index.ts
@@ -1,11 +1,15 @@
import { Cron } from "croner";
import { checkDueDateReminders } from "./due-date-reminders";
+import { checkProjectWebhookReminders } from "./project-webhook-reminders";
const jobs: Cron[] = [];
export function initializeScheduler(): void {
jobs.push(new Cron("*/5 * * * *", checkDueDateReminders));
- console.log("⏰ Scheduler started (due date reminders every 5 minutes)");
+ jobs.push(new Cron("*/5 * * * *", checkProjectWebhookReminders));
+ console.log(
+ "⏰ Scheduler started (due date and project webhook reminders every 5 minutes)",
+ );
}
export function shutdownScheduler(): void {
diff --git a/apps/api/src/scheduler/project-webhook-reminders.ts b/apps/api/src/scheduler/project-webhook-reminders.ts
new file mode 100644
index 000000000..31ffb6f65
--- /dev/null
+++ b/apps/api/src/scheduler/project-webhook-reminders.ts
@@ -0,0 +1,105 @@
+import { and, between, eq, isNotNull, isNull, or } from "drizzle-orm";
+import db from "../database";
+import {
+ columnTable,
+ integrationTable,
+ taskReminderSentTable,
+ taskTable,
+} from "../database/schema";
+import {
+ type GenericWebhookConfig,
+ normalizeGenericWebhookConfig,
+} from "../plugins/generic-webhook/config";
+import { sendDueDateReminder } from "../plugins/generic-webhook/events";
+import { REMINDER_WINDOW_MINUTES } from "./reminder-timing";
+
+const MINUTE_MS = 60 * 1000;
+
+export async function checkProjectWebhookReminders(): Promise<void> {
+ const now = new Date();
+ const integrations = await db
+ .select({
+ id: integrationTable.id,
+ projectId: integrationTable.projectId,
+ config: integrationTable.config,
+ })
+ .from(integrationTable)
+ .where(
+ and(
+ eq(integrationTable.type, "generic-webhook"),
+ eq(integrationTable.isActive, true),
+ ),
+ );
+
+ for (const integration of integrations) {
+ try {
+ const config = normalizeGenericWebhookConfig(
+ JSON.parse(integration.config) as GenericWebhookConfig,
+ );
+ if (!config.events?.dueDateReminder) continue;
+
+ const leadTimeMinutes = config.dueDateReminderLeadTimeMinutes ?? 1440;
+ const windowEnd = new Date(now.getTime() + leadTimeMinutes * MINUTE_MS);
+ const windowStart = new Date(
+ windowEnd.getTime() - REMINDER_WINDOW_MINUTES * MINUTE_MS,
+ );
+ const reminderType = `generic_webhook:${integration.id}`;
+ const tasks = await db
+ .select({ id: taskTable.id, dueDate: taskTable.dueDate })
+ .from(taskTable)
+ .leftJoin(columnTable, eq(taskTable.columnId, columnTable.id))
+ .leftJoin(
+ taskReminderSentTable,
+ and(
+ eq(taskReminderSentTable.taskId, taskTable.id),
+ eq(taskReminderSentTable.reminderType, reminderType),
+ ),
+ )
+ .where(
+ and(
+ eq(taskTable.projectId, integration.projectId),
+ isNotNull(taskTable.dueDate),
+ between(taskTable.dueDate, windowStart, windowEnd),
+ isNull(taskReminderSentTable.id),
+ or(isNull(columnTable.isFinal), eq(columnTable.isFinal, false)),
+ ),
+ );
+
+ for (const task of tasks) {
+ if (!task.dueDate) continue;
+
+ const [sentRecord] = await db
+ .insert(taskReminderSentTable)
+ .values({ taskId: task.id, reminderType })
+ .onConflictDoNothing({
+ target: [
+ taskReminderSentTable.taskId,
+ taskReminderSentTable.reminderType,
+ ],
+ })
+ .returning({ id: taskReminderSentTable.id });
+ if (!sentRecord) continue;
+
+ const delivered = await sendDueDateReminder(
+ config,
+ task.id,
+ integration.projectId,
+ leadTimeMinutes,
+ task.dueDate,
+ );
+
+ if (!delivered) {
+ await db
+ .delete(taskReminderSentTable)
+ .where(eq(taskReminderSentTable.id, sentRecord.id));
+ }
+ }
+ } catch (error) {
+ console.error("Failed to process project webhook reminder", {
+ integrationId: integration.id,
+ projectId: integration.projectId,
+ error,
+ });
+ }
+ }
+}
diff --git a/apps/api/src/scheduler/reminder-timing.ts b/apps/api/src/scheduler/reminder-timing.ts
new file mode 100644
index 000000000..1ece6b69c
--- /dev/null
+++ b/apps/api/src/scheduler/reminder-timing.ts
@@ -0,0 +1,21 @@
+const MINUTE_MS = 60 * 1000;
+
+export const REMINDER_WINDOW_MINUTES = 10;
+
+export function isReminderDue({
+ dueDate,
+ leadTimeMinutes,
+ now,
+}: {
+ dueDate: Date;
+ leadTimeMinutes: number;
+ now: Date;
+}) {
+ const targetTime = dueDate.getTime() - leadTimeMinutes * MINUTE_MS;
+ const elapsedSinceTarget = now.getTime() - targetTime;
+
+ return (
+ elapsedSinceTarget >= 0 &&
+ elapsedSinceTarget <= REMINDER_WINDOW_MINUTES * MINUTE_MS
+ );
+}
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index 4c4d7e91d..0de5066d8 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -94,6 +94,7 @@ export const notificationSchema = v.object({
"due_date_reminder",
"task_overdue",
"task_mention",
+ "task_comment",
] as const),
eventData: v.nullable(v.record(v.string(), v.unknown())),
isRead: v.optional(v.boolean()),
@@ -137,6 +138,11 @@ export const notificationPreferenceSchema = v.object({
webhookUrl: v.nullable(v.string()),
webhookSecretConfigured: v.boolean(),
maskedWebhookSecret: v.nullable(v.string()),
+ taskAssignmentEnabled: v.boolean(),
+ taskCommentEnabled: v.boolean(),
+ taskStatusChangeEnabled: v.boolean(),
+ dueDateReminderEnabled: v.boolean(),
+ dueDateReminderLeadTimeMinutes: v.number(),
workspaces: v.array(notificationPreferenceWorkspaceRuleSchema),
createdAt: v.nullable(v.date()),
updatedAt: v.nullable(v.date()),
@@ -211,7 +217,11 @@ export const genericWebhookIntegrationSchema = v.object({
maskedWebhookUrl: v.nullable(v.string()),
secretConfigured: v.boolean(),
maskedSecret: v.nullable(v.string()),
- events: integrationEventsSchema,
+ events: v.object({
+ ...integrationEventsSchema.entries,
+ dueDateReminder: v.boolean(),
+ }),
+ dueDateReminderLeadTimeMinutes: v.number(),
isActive: v.nullable(v.boolean()),
createdAt: v.date(),
updatedAt: v.date(),
diff --git a/apps/api/src/utils/migrate-notification-preferences-schema.ts b/apps/api/src/utils/migrate-notification-preferences-schema.ts
index 529d29184..7718c0216 100644
--- a/apps/api/src/utils/migrate-notification-preferences-schema.ts
+++ b/apps/api/src/utils/migrate-notification-preferences-schema.ts
@@ -24,6 +24,11 @@ export async function migrateNotificationPreferencesSchema() {
"webhook_enabled" boolean DEFAULT false NOT NULL,
"webhook_url" text,
"webhook_secret" text,
+ "task_assignment_enabled" boolean DEFAULT true NOT NULL,
+ "task_comment_enabled" boolean DEFAULT true NOT NULL,
+ "task_status_change_enabled" boolean DEFAULT true NOT NULL,
+ "due_date_reminder_enabled" boolean DEFAULT true NOT NULL,
+ "due_date_reminder_lead_time_minutes" integer DEFAULT 1440 NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
@@ -42,6 +47,11 @@ export async function migrateNotificationPreferencesSchema() {
ADD COLUMN IF NOT EXISTS "webhook_enabled" boolean DEFAULT false NOT NULL,
ADD COLUMN IF NOT EXISTS "webhook_url" text,
ADD COLUMN IF NOT EXISTS "webhook_secret" text,
+ ADD COLUMN IF NOT EXISTS "task_assignment_enabled" boolean DEFAULT true NOT NULL,
+ ADD COLUMN IF NOT EXISTS "task_comment_enabled" boolean DEFAULT true NOT NULL,
+ ADD COLUMN IF NOT EXISTS "task_status_change_enabled" boolean DEFAULT true NOT NULL,
+ ADD COLUMN IF NOT EXISTS "due_date_reminder_enabled" boolean DEFAULT true NOT NULL,
+ ADD COLUMN IF NOT EXISTS "due_date_reminder_lead_time_minutes" integer DEFAULT 1440 NOT NULL,
ADD COLUMN IF NOT EXISTS "created_at" timestamp DEFAULT now() NOT NULL,
ADD COLUMN IF NOT EXISTS "updated_at" timestamp DEFAULT now() NOT NULL;
`);
diff --git a/apps/web/src/components/account/notification-preferences-settings.test.tsx b/apps/web/src/components/account/notification-preferences-settings.test.tsx
new file mode 100644
index 000000000..e59a3ac01
--- /dev/null
+++ b/apps/web/src/components/account/notification-preferences-settings.test.tsx
@@ -0,0 +1,149 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { NotificationPreferencesSettings } from "./notification-preferences-settings";
+
+const updatePreferences = vi.fn();
+const preferences = {
+ emailAddress: "[email protected]",
+ emailEnabled: false,
+ ntfyEnabled: false,
+ ntfyConfigured: false,
+ ntfyServerUrl: null,
+ ntfyTopic: null,
+ ntfyTokenConfigured: false,
+ maskedNtfyToken: null,
+ gotifyEnabled: false,
+ gotifyConfigured: false,
+ gotifyServerUrl: null,
+ gotifyTokenConfigured: false,
+ maskedGotifyToken: null,
+ webhookEnabled: false,
+ webhookConfigured: false,
+ webhookUrl: null,
+ webhookSecretConfigured: false,
+ maskedWebhookSecret: null,
+ taskAssignmentEnabled: true,
+ taskCommentEnabled: true,
+ taskStatusChangeEnabled: true,
+ dueDateReminderEnabled: true,
+ dueDateReminderLeadTimeMinutes: 1440,
+ workspaces: [],
+ createdAt: null,
+ updatedAt: null,
+};
+
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock(
+ "@/hooks/queries/notification-preferences/use-get-notification-preferences",
+ () => ({
+ default: () => ({
+ data: preferences,
+ isLoading: false,
+ }),
+ }),
+);
+
+vi.mock("@/hooks/queries/workspace/use-get-workspaces", () => ({
+ default: () => ({ data: [] }),
+}));
+
+vi.mock(
+ "@/hooks/mutations/notification-preferences/use-notification-preferences",
+ () => ({
+ useUpdateNotificationPreferences: () => ({
+ mutateAsync: updatePreferences,
+ isPending: false,
+ }),
+ useUpsertNotificationWorkspaceRule: () => ({ mutateAsync: vi.fn() }),
+ useDeleteNotificationWorkspaceRule: () => ({ mutateAsync: vi.fn() }),
+ }),
+);
+
+describe("NotificationPreferencesSettings", () => {
+ afterEach(cleanup);
+
+ beforeEach(() => {
+ updatePreferences.mockReset();
+ updatePreferences.mockResolvedValue(undefined);
+ });
+
+ it("saves event preferences and a configurable reminder lead time", async () => {
+ render(<NotificationPreferencesSettings />);
+
+ fireEvent.click(
+ screen.getByLabelText("settings:notificationsPage.eventTaskAssignments"),
+ );
+ fireEvent.change(
+ screen.getByLabelText("settings:notificationsPage.reminderLeadTimeLabel"),
+ { target: { value: "2" } },
+ );
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:notificationsPage.saveEventPreferences",
+ }),
+ );
+
+ await waitFor(() =>
+ expect(updatePreferences).toHaveBeenCalledWith({
+ taskAssignmentEnabled: false,
+ taskCommentEnabled: true,
+ taskStatusChangeEnabled: true,
+ dueDateReminderEnabled: true,
+ dueDateReminderLeadTimeMinutes: 2880,
+ }),
+ );
+ });
+
+ it("blocks saving a cleared reminder lead time", () => {
+ render(<NotificationPreferencesSettings />);
+
+ fireEvent.change(
+ screen.getByLabelText("settings:notificationsPage.reminderLeadTimeLabel"),
+ { target: { value: "" } },
+ );
+
+ expect(
+ screen.getByText("settings:notificationsPage.reminderLeadTimeInvalid"),
+ ).toBeTruthy();
+ expect(
+ screen.getByRole("button", {
+ name: "settings:notificationsPage.saveEventPreferences",
+ }),
+ ).toHaveProperty("disabled", true);
+ });
+
+ it("saves disabled reminders without validating their retained lead time", async () => {
+ render(<NotificationPreferencesSettings />);
+
+ fireEvent.change(
+ screen.getByLabelText("settings:notificationsPage.reminderLeadTimeLabel"),
+ { target: { value: "0" } },
+ );
+ fireEvent.click(
+ screen.getByLabelText("settings:notificationsPage.eventDueDateReminders"),
+ );
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:notificationsPage.saveEventPreferences",
+ }),
+ );
+
+ await waitFor(() =>
+ expect(updatePreferences).toHaveBeenCalledWith({
+ taskAssignmentEnabled: true,
+ taskCommentEnabled: true,
+ taskStatusChangeEnabled: true,
+ dueDateReminderEnabled: false,
+ }),
+ );
+ });
+});
diff --git a/apps/web/src/components/account/notification-preferences-settings.tsx b/apps/web/src/components/account/notification-preferences-settings.tsx
index ff20edee1..f5016729f 100644
--- a/apps/web/src/components/account/notification-preferences-settings.tsx
+++ b/apps/web/src/components/account/notification-preferences-settings.tsx
@@ -5,7 +5,21 @@ import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
+import {
+ NumberField,
+ NumberFieldDecrement,
+ NumberFieldGroup,
+ NumberFieldIncrement,
+ NumberFieldInput,
+} from "@/components/ui/number-field";
import { Radio, RadioGroup } from "@/components/ui/radio-group";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import { Separator } from "@/components/ui/separator";
import { Switch } from "@/components/ui/switch";
import {
@@ -39,6 +53,15 @@ type GlobalChannelPrefsState = {
webhook: { enabled: boolean; url: string; secret: string };
};
+type NotificationEventPrefsState = {
+ taskAssignmentEnabled: boolean;
+ taskCommentEnabled: boolean;
+ taskStatusChangeEnabled: boolean;
+ dueDateReminderEnabled: boolean;
+ dueDateReminderLeadAmount: number;
+ dueDateReminderLeadUnit: "hours" | "days";
+};
+
function createWorkspaceRuleState(input: {
hasEmailChannel: boolean;
hasGotifyChannel: boolean;
@@ -124,15 +147,20 @@ function ChannelToggle({
label: string;
onCheckedChange: (checked: boolean) => void;
}) {
+ const id = React.useId();
+
return (
<div className="flex items-center justify-between gap-4">
<div className="min-w-0 space-y-0.5">
- <Label className="text-sm font-medium">{label}</Label>
+ <Label className="text-sm font-medium" htmlFor={id}>
+ {label}
+ </Label>
{hint ? <p className="text-xs text-muted-foreground">{hint}</p> : null}
</div>
<Switch
checked={checked}
disabled={disabled}
+ id={id}
onCheckedChange={onCheckedChange}
/>
</div>
@@ -238,6 +266,9 @@ function WorkspaceRuleCard({
</div>
) : null}
<Switch
+ aria-label={t("settings:notificationsPage.workspaceEnabledLabel", {
+ workspaceName: workspace.name,
+ })}
checked={state.isActive}
disabled={isBusy}
onCheckedChange={(checked) =>
@@ -462,6 +493,15 @@ export function NotificationPreferencesSettings() {
const [globalPrefs, setGlobalPrefs] = React.useState<GlobalChannelPrefsState>(
createDefaultGlobalChannelPrefs,
);
+ const [eventPrefs, setEventPrefs] =
+ React.useState<NotificationEventPrefsState>({
+ taskAssignmentEnabled: true,
+ taskCommentEnabled: true,
+ taskStatusChangeEnabled: true,
+ dueDateReminderEnabled: true,
+ dueDateReminderLeadAmount: 1,
+ dueDateReminderLeadUnit: "days",
+ });
React.useEffect(() => {
if (!preferences) return;
@@ -484,8 +524,33 @@ export function NotificationPreferencesSettings() {
secret: "",
},
});
+ const leadMinutes = preferences.dueDateReminderLeadTimeMinutes;
+ setEventPrefs({
+ taskAssignmentEnabled: preferences.taskAssignmentEnabled,
+ taskCommentEnabled: preferences.taskCommentEnabled,
+ taskStatusChangeEnabled: preferences.taskStatusChangeEnabled,
+ dueDateReminderEnabled: preferences.dueDateReminderEnabled,
+ ...(leadMinutes > 0 && leadMinutes % 1440 === 0
+ ? {
+ dueDateReminderLeadAmount: leadMinutes / 1440,
+ dueDateReminderLeadUnit: "days" as const,
+ }
+ : {
+ dueDateReminderLeadAmount: Math.max(
+ 1,
+ Math.round(leadMinutes / 60),
+ ),
+ dueDateReminderLeadUnit: "hours" as const,
+ }),
+ });
}, [preferences]);
+ const leadTimeMax = eventPrefs.dueDateReminderLeadUnit === "days" ? 30 : 720;
+ const leadTimeValid =
+ Number.isInteger(eventPrefs.dueDateReminderLeadAmount) &&
+ eventPrefs.dueDateReminderLeadAmount >= 1 &&
+ eventPrefs.dueDateReminderLeadAmount <= leadTimeMax;
+
const workspaceRuleMap = React.useMemo(
() =>
new Map(
@@ -509,6 +574,156 @@ export function NotificationPreferencesSettings() {
return (
<div className="space-y-8">
+ <div className="flex flex-col gap-5 rounded-md border bg-sidebar p-4">
+ <div className="flex flex-col gap-1">
+ <h2 className="font-medium">
+ {t("settings:notificationsPage.eventPreferencesTitle")}
+ </h2>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.eventPreferencesDescription")}
+ </p>
+ </div>
+
+ <div className="flex flex-col gap-4">
+ <ChannelToggle
+ checked={eventPrefs.taskAssignmentEnabled}
+ label={t("settings:notificationsPage.eventTaskAssignments")}
+ onCheckedChange={(checked) =>
+ setEventPrefs((current) => ({
+ ...current,
+ taskAssignmentEnabled: checked,
+ }))
+ }
+ />
+ <ChannelToggle
+ checked={eventPrefs.taskCommentEnabled}
+ hint={t("settings:notificationsPage.eventCommentsHint")}
+ label={t("settings:notificationsPage.eventComments")}
+ onCheckedChange={(checked) =>
+ setEventPrefs((current) => ({
+ ...current,
+ taskCommentEnabled: checked,
+ }))
+ }
+ />
+ <ChannelToggle
+ checked={eventPrefs.taskStatusChangeEnabled}
+ label={t("settings:notificationsPage.eventStatusChanges")}
+ onCheckedChange={(checked) =>
+ setEventPrefs((current) => ({
+ ...current,
+ taskStatusChangeEnabled: checked,
+ }))
+ }
+ />
+ <ChannelToggle
+ checked={eventPrefs.dueDateReminderEnabled}
+ label={t("settings:notificationsPage.eventDueDateReminders")}
+ onCheckedChange={(checked) =>
+ setEventPrefs((current) => ({
+ ...current,
+ dueDateReminderEnabled: checked,
+ }))
+ }
+ />
+ </div>
+
+ <div className="flex max-w-sm flex-col gap-1">
+ <Label htmlFor="due-date-reminder-lead-time">
+ {t("settings:notificationsPage.reminderLeadTimeLabel")}
+ </Label>
+ <div className="flex gap-2">
+ <NumberField
+ className="w-36"
+ disabled={!eventPrefs.dueDateReminderEnabled}
+ id="due-date-reminder-lead-time"
+ max={leadTimeMax}
+ min={1}
+ onValueChange={(value) =>
+ setEventPrefs((current) => ({
+ ...current,
+ dueDateReminderLeadAmount: value ?? 0,
+ }))
+ }
+ step={1}
+ value={eventPrefs.dueDateReminderLeadAmount}
+ >
+ <NumberFieldGroup>
+ <NumberFieldDecrement />
+ <NumberFieldInput />
+ <NumberFieldIncrement />
+ </NumberFieldGroup>
+ </NumberField>
+ <Select
+ disabled={!eventPrefs.dueDateReminderEnabled}
+ onValueChange={(unit) =>
+ setEventPrefs((current) => ({
+ ...current,
+ dueDateReminderLeadUnit: unit as "hours" | "days",
+ }))
+ }
+ value={eventPrefs.dueDateReminderLeadUnit}
+ >
+ <SelectTrigger className="w-32">
+ <SelectValue>
+ {eventPrefs.dueDateReminderLeadUnit === "days"
+ ? t("settings:notificationsPage.reminderLeadTimeUnitDays")
+ : t("settings:notificationsPage.reminderLeadTimeUnitHours")}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="hours">
+ {t("settings:notificationsPage.reminderLeadTimeUnitHours")}
+ </SelectItem>
+ <SelectItem value="days">
+ {t("settings:notificationsPage.reminderLeadTimeUnitDays")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+ {eventPrefs.dueDateReminderEnabled && !leadTimeValid ? (
+ <p className="text-xs text-destructive">
+ {t("settings:notificationsPage.reminderLeadTimeInvalid", {
+ max: leadTimeMax,
+ })}
+ </p>
+ ) : (
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.reminderLeadTimeHint")}
+ </p>
+ )}
+ </div>
+
+ <div>
+ <Button
+ disabled={
+ isSavingPreferences ||
+ (eventPrefs.dueDateReminderEnabled && !leadTimeValid)
+ }
+ onClick={async () => {
+ await updatePreferences({
+ taskAssignmentEnabled: eventPrefs.taskAssignmentEnabled,
+ taskCommentEnabled: eventPrefs.taskCommentEnabled,
+ taskStatusChangeEnabled: eventPrefs.taskStatusChangeEnabled,
+ dueDateReminderEnabled: eventPrefs.dueDateReminderEnabled,
+ ...(eventPrefs.dueDateReminderEnabled
+ ? {
+ dueDateReminderLeadTimeMinutes:
+ eventPrefs.dueDateReminderLeadAmount *
+ (eventPrefs.dueDateReminderLeadUnit === "days"
+ ? 1440
+ : 60),
+ }
+ : {}),
+ });
+ }}
+ type="button"
+ >
+ {t("settings:notificationsPage.saveEventPreferences")}
+ </Button>
+ </div>
+ </div>
+
<ChannelCard
actions={
<div className="flex gap-2">
diff --git a/apps/web/src/components/notification/notification-dropdown.test.ts b/apps/web/src/components/notification/notification-dropdown.test.ts
new file mode 100644
index 000000000..09e77af35
--- /dev/null
+++ b/apps/web/src/components/notification/notification-dropdown.test.ts
@@ -0,0 +1,71 @@
+import { describe, expect, it } from "vitest";
+import type { Notification } from "@/types/notification";
+import {
+ getNotificationContent,
+ getNotificationTitle,
+} from "./notification-dropdown";
+
+const t = (
+ key: string,
+ options?: Record<string, number | string | undefined>,
+) => {
+ if (key === "notifications:reminderLeadTime.days") {
+ return `${options?.count} days`;
+ }
+ if (key === "notifications:events.due_date_reminder.content") {
+ return `${options?.taskTitle} is due in ${options?.leadTime}`;
+ }
+ if (key === "notifications:events.task_comment.title") {
+ return `${options?.commenterName} commented on your task`;
+ }
+ if (key === "notifications:events.task_comment.content") {
+ return `New comment on ${options?.taskTitle}: ${options?.commentPreview}`;
+ }
+ return key;
+};
+
+function notification(
+ type: string,
+ eventData: Record<string, unknown>,
+): Notification {
+ return {
+ id: "notification-1",
+ userId: "user-1",
+ title: null,
+ content: null,
+ type,
+ eventData,
+ isRead: false,
+ createdAt: "2026-07-12T10:00:00.000Z",
+ updatedAt: "2026-07-12T10:00:00.000Z",
+ } as unknown as Notification;
+}
+
+describe("notification display content", () => {
+ it("renders configured due-date lead times", () => {
+ const item = notification("due_date_reminder", {
+ taskTitle: "Launch website",
+ leadTimeMinutes: 2880,
+ });
+
+ expect(getNotificationTitle(item, t)).toBe(
+ "notifications:events.due_date_reminder.title",
+ );
+ expect(getNotificationContent(item, t)).toBe(
+ "Launch website is due in 2 days",
+ );
+ });
+
+ it("renders comment notifications with their preview", () => {
+ const item = notification("task_comment", {
+ taskTitle: "Launch website",
+ commenterName: "Mina",
+ commentPreview: "Ready for review",
+ });
+
+ expect(getNotificationTitle(item, t)).toBe("Mina commented on your task");
+ expect(getNotificationContent(item, t)).toBe(
+ "New comment on Launch website: Ready for review",
+ );
+ });
+});
diff --git a/apps/web/src/components/notification/notification-dropdown.tsx b/apps/web/src/components/notification/notification-dropdown.tsx
index 1601bbc08..ff6432962 100644
--- a/apps/web/src/components/notification/notification-dropdown.tsx
+++ b/apps/web/src/components/notification/notification-dropdown.tsx
@@ -51,7 +51,25 @@ function getEventDataRecord(
return eventData as Record<string, unknown>;
}
-function getNotificationTitle(
+function getReminderLeadTime(
+ eventData: Record<string, unknown>,
+ t: (key: string, options?: Record<string, unknown>) => string,
+) {
+ const minutes = Number(eventData.leadTimeMinutes ?? 1440);
+ if (minutes % 1440 === 0) {
+ return t("notifications:reminderLeadTime.days", {
+ count: minutes / 1440,
+ });
+ }
+ if (minutes % 60 === 0) {
+ return t("notifications:reminderLeadTime.hours", {
+ count: minutes / 60,
+ });
+ }
+ return t("notifications:reminderLeadTime.minutes", { count: minutes });
+}
+
+export function getNotificationTitle(
notification: Notification,
t: (key: string, options?: Record<string, unknown>) => string,
) {
@@ -88,6 +106,21 @@ function getNotificationTitle(
...eventData,
defaultValue: notification.title ?? notification.type,
});
+ case "task_comment":
+ return t("notifications:events.task_comment.title", {
+ ...eventData,
+ defaultValue: notification.title ?? notification.type,
+ });
+ case "due_date_reminder":
+ return t("notifications:events.due_date_reminder.title", {
+ ...eventData,
+ defaultValue: notification.title ?? notification.type,
+ });
+ case "task_overdue":
+ return t("notifications:events.task_overdue.title", {
+ ...eventData,
+ defaultValue: notification.title ?? notification.type,
+ });
default:
break;
}
@@ -96,7 +129,7 @@ function getNotificationTitle(
return notification.title ?? notification.type;
}
-function getNotificationContent(
+export function getNotificationContent(
notification: Notification,
t: (key: string, options?: Record<string, unknown>) => string,
) {
@@ -140,6 +173,22 @@ function getNotificationContent(
...eventData,
defaultValue: notification.content ?? "",
});
+ case "task_comment":
+ return t("notifications:events.task_comment.content", {
+ ...eventData,
+ defaultValue: notification.content ?? "",
+ });
+ case "due_date_reminder":
+ return t("notifications:events.due_date_reminder.content", {
+ ...eventData,
+ leadTime: getReminderLeadTime(eventData, t),
+ defaultValue: notification.content ?? "",
+ });
+ case "task_overdue":
+ return t("notifications:events.task_overdue.content", {
+ ...eventData,
+ defaultValue: notification.content ?? "",
+ });
default:
break;
}
diff --git a/apps/web/src/components/project/generic-webhook-integration-settings.test.tsx b/apps/web/src/components/project/generic-webhook-integration-settings.test.tsx
new file mode 100644
index 000000000..8e85bb036
--- /dev/null
+++ b/apps/web/src/components/project/generic-webhook-integration-settings.test.tsx
@@ -0,0 +1,130 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { GenericWebhookIntegrationSettings } from "./generic-webhook-integration-settings";
+
+const createIntegration = vi.fn();
+
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+
+vi.mock(
+ "@/hooks/queries/generic-webhook-integration/use-get-generic-webhook-integration",
+ () => ({ default: () => ({ data: null, isLoading: false }) }),
+);
+
+vi.mock(
+ "@/hooks/mutations/generic-webhook-integration/use-generic-webhook-integration",
+ () => ({
+ useCreateGenericWebhookIntegration: () => ({
+ mutateAsync: createIntegration,
+ isPending: false,
+ }),
+ useUpdateGenericWebhookIntegration: () => ({
+ mutateAsync: vi.fn(),
+ isPending: false,
+ }),
+ useDeleteGenericWebhookIntegration: () => ({
+ mutateAsync: vi.fn(),
+ isPending: false,
+ }),
+ }),
+);
+
+vi.mock("@/lib/toast", () => ({
+ toast: { success: vi.fn(), error: vi.fn() },
+}));
+
+describe("GenericWebhookIntegrationSettings", () => {
+ afterEach(cleanup);
+
+ beforeEach(() => {
+ createIntegration.mockReset();
+ createIntegration.mockResolvedValue(undefined);
+ });
+
+ it("creates an opt-in project reminder webhook with its lead time", async () => {
+ render(<GenericWebhookIntegrationSettings projectId="project-1" />);
+
+ fireEvent.change(
+ screen.getByLabelText("settings:genericWebhookIntegration.webhookLabel"),
+ { target: { value: "https://example.com/hooks/kaneo" } },
+ );
+ fireEvent.click(
+ screen.getByLabelText(
+ "settings:genericWebhookIntegration.events.dueDateReminder",
+ ),
+ );
+ fireEvent.change(
+ screen.getByLabelText(
+ "settings:genericWebhookIntegration.reminderLeadTimeLabel",
+ ),
+ { target: { value: "48" } },
+ );
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:genericWebhookIntegration.connect",
+ }),
+ );
+
+ await waitFor(() =>
+ expect(createIntegration).toHaveBeenCalledWith({
+ projectId: "project-1",
+ data: expect.objectContaining({
+ webhookUrl: "https://example.com/hooks/kaneo",
+ dueDateReminderLeadTimeMinutes: 2880,
+ events: expect.objectContaining({ dueDateReminder: true }),
+ }),
+ }),
+ );
+ });
+
+ it("submits other webhook settings after an invalid reminder time is disabled", async () => {
+ render(<GenericWebhookIntegrationSettings projectId="project-1" />);
+
+ fireEvent.change(
+ screen.getByLabelText("settings:genericWebhookIntegration.webhookLabel"),
+ { target: { value: "https://example.com/hooks/kaneo" } },
+ );
+ fireEvent.click(
+ screen.getByLabelText(
+ "settings:genericWebhookIntegration.events.dueDateReminder",
+ ),
+ );
+ fireEvent.change(
+ screen.getByLabelText(
+ "settings:genericWebhookIntegration.reminderLeadTimeLabel",
+ ),
+ { target: { value: "0" } },
+ );
+ fireEvent.click(
+ screen.getByLabelText(
+ "settings:genericWebhookIntegration.events.dueDateReminder",
+ ),
+ );
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "settings:genericWebhookIntegration.connect",
+ }),
+ );
+
+ await waitFor(() =>
+ expect(createIntegration).toHaveBeenCalledWith({
+ projectId: "project-1",
+ data: expect.objectContaining({
+ webhookUrl: "https://example.com/hooks/kaneo",
+ events: expect.objectContaining({ dueDateReminder: false }),
+ }),
+ }),
+ );
+ expect(createIntegration.mock.calls[0]?.[0].data).not.toHaveProperty(
+ "dueDateReminderLeadTimeMinutes",
+ );
+ });
+});
diff --git a/apps/web/src/components/project/generic-webhook-integration-settings.tsx b/apps/web/src/components/project/generic-webhook-integration-settings.tsx
index 081468453..8a59bbe59 100644
--- a/apps/web/src/components/project/generic-webhook-integration-settings.tsx
+++ b/apps/web/src/components/project/generic-webhook-integration-settings.tsx
@@ -32,6 +32,8 @@ type GenericWebhookIntegrationFormValues = {
taskTitleChanged: boolean;
taskDescriptionChanged: boolean;
taskCommentCreated: boolean;
+ dueDateReminder: boolean;
+ dueDateReminderLeadTimeHours: number;
};
function EventToggle({
@@ -50,6 +52,7 @@ function EventToggle({
| "taskTitleChanged"
| "taskDescriptionChanged"
| "taskCommentCreated"
+ | "dueDateReminder"
>;
label: string;
}) {
@@ -80,16 +83,26 @@ export function GenericWebhookIntegrationSettings({
const { t } = useTranslation();
const schema = React.useMemo(
() =>
- z.object({
- webhookUrl: z.string(),
- secret: z.string(),
- taskCreated: z.boolean(),
- taskStatusChanged: z.boolean(),
- taskPriorityChanged: z.boolean(),
- taskTitleChanged: z.boolean(),
- taskDescriptionChanged: z.boolean(),
- taskCommentCreated: z.boolean(),
- }),
+ z
+ .object({
+ webhookUrl: z.string(),
+ secret: z.string(),
+ taskCreated: z.boolean(),
+ taskStatusChanged: z.boolean(),
+ taskPriorityChanged: z.boolean(),
+ taskTitleChanged: z.boolean(),
+ taskDescriptionChanged: z.boolean(),
+ taskCommentCreated: z.boolean(),
+ dueDateReminder: z.boolean(),
+ dueDateReminderLeadTimeHours: z.number(),
+ })
+ .refine(
+ (values) =>
+ !values.dueDateReminder ||
+ (values.dueDateReminderLeadTimeHours >= 5 / 60 &&
+ values.dueDateReminderLeadTimeHours <= 720),
+ { path: ["dueDateReminderLeadTimeHours"] },
+ ),
[],
);
@@ -113,6 +126,9 @@ export function GenericWebhookIntegrationSettings({
taskDescriptionChanged:
integration?.events?.taskDescriptionChanged ?? false,
taskCommentCreated: integration?.events?.taskCommentCreated ?? true,
+ dueDateReminder: integration?.events?.dueDateReminder ?? false,
+ dueDateReminderLeadTimeHours:
+ (integration?.dueDateReminderLeadTimeMinutes ?? 1440) / 60,
}),
[integration],
);
@@ -141,6 +157,7 @@ export function GenericWebhookIntegrationSettings({
taskTitleChanged: values.taskTitleChanged,
taskDescriptionChanged: values.taskDescriptionChanged,
taskCommentCreated: values.taskCommentCreated,
+ dueDateReminder: values.dueDateReminder,
};
if (!trimmedWebhookUrl || !z.url().safeParse(trimmedWebhookUrl).success) {
@@ -159,6 +176,13 @@ export function GenericWebhookIntegrationSettings({
webhookUrl: trimmedWebhookUrl,
secret: trimmedSecret || undefined,
events,
+ ...(values.dueDateReminder
+ ? {
+ dueDateReminderLeadTimeMinutes: Math.round(
+ values.dueDateReminderLeadTimeHours * 60,
+ ),
+ }
+ : {}),
},
});
} else {
@@ -168,6 +192,13 @@ export function GenericWebhookIntegrationSettings({
webhookUrl: trimmedWebhookUrl,
secret: trimmedSecret || undefined,
events,
+ ...(values.dueDateReminder
+ ? {
+ dueDateReminderLeadTimeMinutes: Math.round(
+ values.dueDateReminderLeadTimeHours * 60,
+ ),
+ }
+ : {}),
},
});
}
@@ -219,6 +250,8 @@ export function GenericWebhookIntegrationSettings({
taskTitleChanged: false,
taskDescriptionChanged: false,
taskCommentCreated: true,
+ dueDateReminder: false,
+ dueDateReminderLeadTimeHours: 24,
});
toast.success(t("settings:genericWebhookIntegration.toast.removed"));
} catch (error) {
@@ -384,6 +417,41 @@ export function GenericWebhookIntegrationSettings({
)}
name="taskCommentCreated"
/>
+ <EventToggle
+ control={form.control}
+ label={t(
+ "settings:genericWebhookIntegration.events.dueDateReminder",
+ )}
+ name="dueDateReminder"
+ />
+ {form.watch("dueDateReminder") ? (
+ <FormField
+ control={form.control}
+ name="dueDateReminderLeadTimeHours"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ {t(
+ "settings:genericWebhookIntegration.reminderLeadTimeLabel",
+ )}
+ </FormLabel>
+ <FormControl>
+ <Input
+ max={720}
+ min={5 / 60}
+ onChange={(event) =>
+ field.onChange(Number(event.target.value))
+ }
+ step="any"
+ type="number"
+ value={field.value}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ ) : null}
</div>
<div className="flex flex-wrap gap-2">
diff --git a/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
index c0cc2869b..d54c75a2a 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/create-generic-webhook-integration.ts
@@ -11,7 +11,9 @@ export type CreateGenericWebhookIntegrationRequest = {
taskTitleChanged?: boolean;
taskDescriptionChanged?: boolean;
taskCommentCreated?: boolean;
+ dueDateReminder?: boolean;
};
+ dueDateReminderLeadTimeMinutes?: number;
};
async function createGenericWebhookIntegration(
diff --git a/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
index 7fd06bb70..a1781d2b5 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/get-generic-webhook-integration.ts
@@ -14,7 +14,9 @@ export type GenericWebhookIntegration = {
taskTitleChanged: boolean;
taskDescriptionChanged: boolean;
taskCommentCreated: boolean;
+ dueDateReminder: boolean;
};
+ dueDateReminderLeadTimeMinutes: number;
isActive: boolean | null;
createdAt: string;
updatedAt: string;
diff --git a/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts b/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
index fce2f3b04..d5687cf3b 100644
--- a/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
+++ b/apps/web/src/fetchers/generic-webhook-integration/update-generic-webhook-integration.ts
@@ -12,7 +12,9 @@ export type UpdateGenericWebhookIntegrationRequest = {
taskTitleChanged?: boolean;
taskDescriptionChanged?: boolean;
taskCommentCreated?: boolean;
+ dueDateReminder?: boolean;
};
+ dueDateReminderLeadTimeMinutes?: number;
};
async function updateGenericWebhookIntegration(
diff --git a/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
index 510a6e85a..b0dbe6f40 100644
--- a/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
+++ b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
@@ -34,6 +34,11 @@ export type NotificationPreferences = {
webhookUrl: string | null;
webhookSecretConfigured: boolean;
maskedWebhookSecret: string | null;
+ taskAssignmentEnabled: boolean;
+ taskCommentEnabled: boolean;
+ taskStatusChangeEnabled: boolean;
+ dueDateReminderEnabled: boolean;
+ dueDateReminderLeadTimeMinutes: number;
workspaces: NotificationPreferenceWorkspaceRule[];
createdAt: string | null;
updatedAt: string | null;
diff --git a/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
index 4b6f4b074..dfd2279d2 100644
--- a/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
+++ b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
@@ -13,6 +13,11 @@ export type UpdateNotificationPreferencesRequest = {
webhookEnabled?: boolean;
webhookUrl?: string | null;
webhookSecret?: string | null;
+ taskAssignmentEnabled?: boolean;
+ taskCommentEnabled?: boolean;
+ taskStatusChangeEnabled?: boolean;
+ dueDateReminderEnabled?: boolean;
+ dueDateReminderLeadTimeMinutes?: number;
};
async function updateNotificationPreferences(
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index b4ec75d0a..18c0d6555 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -370,6 +370,20 @@
"workspaceRulesTitle": "Zustellregeln für Arbeitsbereiche",
"workspaceRulesDescription": "Nutze deine globalen Kanäle erneut und lege fest, welche Arbeitsbereiche und Projekte Kontobenachrichtigungen senden dürfen.",
"workspaceCardHint": "Wähle, welche Kanäle dieser Arbeitsbereich für Kontobenachrichtigungen nutzen darf.",
+ "workspaceEnabledLabel": "Benachrichtigungen für {{workspaceName}} aktivieren",
+ "eventPreferencesTitle": "Benachrichtige mich über",
+ "eventPreferencesDescription": "Wähle aus, welche Aufgabenereignisse Benachrichtigungen in Kaneo erstellen und über verbundene Kanäle zugestellt werden können.",
+ "eventTaskAssignments": "Aufgabenzuweisungen",
+ "eventComments": "Kommentare und Erwähnungen",
+ "eventCommentsHint": "Umfasst neue Kommentare zu dir zugewiesenen Aufgaben und direkte @Erwähnungen.",
+ "eventStatusChanges": "Statusänderungen von Aufgaben",
+ "eventDueDateReminders": "Erinnerungen an Fälligkeitstermine",
+ "reminderLeadTimeLabel": "Vor dem Fälligkeitsdatum erinnern",
+ "reminderLeadTimeHint": "Zwischen 1 Stunde und 30 Tagen vorher. Überfällige Aufgaben werden separat gemeldet.",
+ "reminderLeadTimeUnitHours": "Stunden",
+ "reminderLeadTimeUnitDays": "Tage",
+ "reminderLeadTimeInvalid": "Gib eine ganze Zahl zwischen 1 und {{max}} ein.",
+ "saveEventPreferences": "Benachrichtigungstypen speichern",
"workspaceCardLabelEmail": "E-Mail",
"workspaceCardLabelNtfy": "ntfy",
"workspaceCardLabelGotify": "Gotify",
@@ -899,8 +913,10 @@
"taskPriorityChanged": "Prioritätsänderungen",
"taskTitleChanged": "Titeländerungen",
"taskDescriptionChanged": "Beschreibungsänderungen",
- "taskCommentCreated": "Neue Kommentare"
+ "taskCommentCreated": "Neue Kommentare",
+ "dueDateReminder": "Erinnerungen an Fälligkeitstermine"
},
+ "reminderLeadTimeLabel": "Webhook so viele Stunden vorher senden",
"connect": "Webhook verbinden",
"saveChanges": "Änderungen speichern",
"disconnect": "Trennen"
@@ -1140,6 +1156,14 @@
"shortcuts": {
"open": "Benachrichtigungen öffnen"
},
+ "reminderLeadTime": {
+ "minutes_one": "{{count}} Minute",
+ "minutes_other": "{{count}} Minuten",
+ "hours_one": "{{count}} Stunde",
+ "hours_other": "{{count}} Stunden",
+ "days_one": "{{count}} Tag",
+ "days_other": "{{count}} Tage"
+ },
"events": {
"task_created": {
"title": "Neue Aufgabe erstellt",
@@ -1157,6 +1181,22 @@
"title": "Aufgabe wurde dir zugewiesen",
"content": "Dir wurde die Aufgabe \"{{taskTitle}}\" zugewiesen"
},
+ "task_mention": {
+ "title": "{{mentionerName}} hat dich erwähnt",
+ "content": "{{mentionerName}} hat dich in „{{taskTitle}}“ erwähnt"
+ },
+ "task_comment": {
+ "title": "{{commenterName}} hat deine Aufgabe kommentiert",
+ "content": "Neuer Kommentar zu „{{taskTitle}}“: {{commentPreview}}"
+ },
+ "due_date_reminder": {
+ "title": "Aufgabe bald fällig",
+ "content": "„{{taskTitle}}“ ist in {{leadTime}} fällig"
+ },
+ "task_overdue": {
+ "title": "Aufgabe überfällig",
+ "content": "„{{taskTitle}}“ ist überfällig"
+ },
"time_entry_created": {
"title": "Zeiterfassung gestartet",
"contentWithTask": "Die Zeiterfassung für die Aufgabe \"{{taskTitle}}\" wurde gestartet",
diff --git a/i18n/en-US.json b/i18n/en-US.json
index ebaf86c6e..b19a35be1 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -372,6 +372,20 @@
"workspaceRulesTitle": "Workspace delivery rules",
"workspaceRulesDescription": "Reuse your global channels, then decide which workspaces and projects are allowed to send account notifications.",
"workspaceCardHint": "Choose which channels this workspace can use for account notifications.",
+ "workspaceEnabledLabel": "Enable notifications for {{workspaceName}}",
+ "eventPreferencesTitle": "Notify me about",
+ "eventPreferencesDescription": "Choose which task events create in-app notifications and can be delivered to your connected channels.",
+ "eventTaskAssignments": "Task assignments",
+ "eventComments": "Comments and mentions",
+ "eventCommentsHint": "Includes new comments on tasks assigned to you and direct @mentions.",
+ "eventStatusChanges": "Task status changes",
+ "eventDueDateReminders": "Due-date reminders",
+ "reminderLeadTimeLabel": "Remind me before the due date",
+ "reminderLeadTimeHint": "Between 1 hour and 30 days before. Overdue notifications are sent separately.",
+ "reminderLeadTimeUnitHours": "Hours",
+ "reminderLeadTimeUnitDays": "Days",
+ "reminderLeadTimeInvalid": "Enter a whole number between 1 and {{max}}.",
+ "saveEventPreferences": "Save notification types",
"workspaceCardLabelEmail": "Email",
"workspaceCardLabelNtfy": "ntfy",
"workspaceCardLabelGotify": "Gotify",
@@ -1063,8 +1077,10 @@
"taskPriorityChanged": "Priority changes",
"taskTitleChanged": "Title changes",
"taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
+ "taskCommentCreated": "New comments",
+ "dueDateReminder": "Due-date reminders"
},
+ "reminderLeadTimeLabel": "Send the webhook this many hours before",
"connect": "Connect webhook",
"saveChanges": "Save changes",
"disconnect": "Disconnect"
@@ -1304,6 +1320,14 @@
"shortcuts": {
"open": "Open notifications"
},
+ "reminderLeadTime": {
+ "minutes_one": "{{count}} minute",
+ "minutes_other": "{{count}} minutes",
+ "hours_one": "{{count}} hour",
+ "hours_other": "{{count}} hours",
+ "days_one": "{{count}} day",
+ "days_other": "{{count}} days"
+ },
"events": {
"task_created": {
"title": "New Task Created",
@@ -1325,6 +1349,18 @@
"title": "{{mentionerName}} mentioned you",
"content": "{{mentionerName}} mentioned you in: {{taskTitle}}"
},
+ "task_comment": {
+ "title": "{{commenterName}} commented on your task",
+ "content": "New comment on {{taskTitle}}: {{commentPreview}}"
+ },
+ "due_date_reminder": {
+ "title": "Task due soon",
+ "content": "{{taskTitle}} is due in {{leadTime}}"
+ },
+ "task_overdue": {
+ "title": "Task overdue",
+ "content": "{{taskTitle}} is past its due date"
+ },
"time_entry_created": {
"title": "Time tracking started",
"contentWithTask": "Time tracking started on task: {{taskTitle}}",
diff --git a/tests/api/plugins/generic-webhook/config-reminders.test.ts b/tests/api/plugins/generic-webhook/config-reminders.test.ts
new file mode 100644
index 000000000..56d3801f4
--- /dev/null
+++ b/tests/api/plugins/generic-webhook/config-reminders.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from "vitest";
+import {
+ defaultGenericWebhookEvents,
+ normalizeGenericWebhookConfig,
+} from "../../../../apps/api/src/plugins/generic-webhook/config";
+
+describe("generic webhook reminder config", () => {
+ it("keeps reminders opt-in with a one-day default lead time", () => {
+ const config = normalizeGenericWebhookConfig({
+ webhookUrl: "https://example.com/hooks/kaneo",
+ });
+
+ expect(config.events).toEqual(defaultGenericWebhookEvents);
+ expect(config.events?.dueDateReminder).toBe(false);
+ expect(config.dueDateReminderLeadTimeMinutes).toBe(1440);
+ });
+
+ it("preserves a configured reminder lead time", () => {
+ const config = normalizeGenericWebhookConfig({
+ webhookUrl: "https://example.com/hooks/kaneo",
+ events: { dueDateReminder: true },
+ dueDateReminderLeadTimeMinutes: 2880,
+ });
+
+ expect(config.events?.dueDateReminder).toBe(true);
+ expect(config.dueDateReminderLeadTimeMinutes).toBe(2880);
+ });
+});
diff --git a/tests/api/scheduler/reminder-timing.test.ts b/tests/api/scheduler/reminder-timing.test.ts
new file mode 100644
index 000000000..eea41f57d
--- /dev/null
+++ b/tests/api/scheduler/reminder-timing.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it } from "vitest";
+import { isReminderDue } from "../../../apps/api/src/scheduler/reminder-timing";
+
+describe("isReminderDue", () => {
+ const now = new Date("2026-07-12T10:00:00.000Z");
+
+ it("matches a configured lead time", () => {
+ expect(
+ isReminderDue({
+ dueDate: new Date("2026-07-14T10:00:00.000Z"),
+ leadTimeMinutes: 2 * 24 * 60,
+ now,
+ }),
+ ).toBe(true);
+ });
+
+ it("accepts scheduler runs within the ten minute delivery window", () => {
+ expect(
+ isReminderDue({
+ dueDate: new Date("2026-07-13T09:55:00.000Z"),
+ leadTimeMinutes: 24 * 60,
+ now,
+ }),
+ ).toBe(true);
+ });
+
+ it("does not send before or after the delivery window", () => {
+ expect(
+ isReminderDue({
+ dueDate: new Date("2026-07-13T10:05:00.000Z"),
+ leadTimeMinutes: 24 * 60,
+ now,
+ }),
+ ).toBe(false);
+ expect(
+ isReminderDue({
+ dueDate: new Date("2026-07-13T09:49:00.000Z"),
+ leadTimeMinutes: 24 * 60,
+ now,
+ }),
+ ).toBe(false);
+ });
+});