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: add account notification delivery settings

Tin4ed1d98a76de
diff --git a/apps/api/drizzle/0020_careful_shiver_man.sql b/apps/api/drizzle/0020_careful_shiver_man.sql
new file mode 100644
index 000000000..b39d75897
--- /dev/null
+++ b/apps/api/drizzle/0020_careful_shiver_man.sql
@@ -0,0 +1,45 @@
+CREATE TABLE "user_notification_preference" (
+ "user_id" text PRIMARY KEY NOT NULL,
+ "email_enabled" boolean DEFAULT false NOT NULL,
+ "ntfy_enabled" boolean DEFAULT false NOT NULL,
+ "ntfy_server_url" text,
+ "ntfy_topic" text,
+ "ntfy_token" text,
+ "webhook_enabled" boolean DEFAULT false NOT NULL,
+ "webhook_url" text,
+ "webhook_secret" text,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "user_notification_workspace_project" (
+ "id" text PRIMARY KEY NOT NULL,
+ "workspace_rule_id" text NOT NULL,
+ "project_id" text NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ CONSTRAINT "user_notification_workspace_project_rule_project_unique" UNIQUE("workspace_rule_id","project_id")
+);
+--> statement-breakpoint
+CREATE TABLE "user_notification_workspace_rule" (
+ "id" text PRIMARY KEY NOT NULL,
+ "user_id" text NOT NULL,
+ "workspace_id" text NOT NULL,
+ "is_active" boolean DEFAULT true NOT NULL,
+ "email_enabled" boolean DEFAULT false NOT NULL,
+ "ntfy_enabled" boolean DEFAULT false NOT NULL,
+ "webhook_enabled" boolean DEFAULT false NOT NULL,
+ "project_mode" text DEFAULT 'all' NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL,
+ CONSTRAINT "user_notification_workspace_rule_user_workspace_unique" UNIQUE("user_id","workspace_id")
+);
+--> statement-breakpoint
+ALTER TABLE "user_notification_preference" ADD CONSTRAINT "user_notification_preference_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "user_notification_workspace_project" ADD CONSTRAINT "user_notification_workspace_project_workspace_rule_id_user_notification_workspace_rule_id_fk" FOREIGN KEY ("workspace_rule_id") REFERENCES "public"."user_notification_workspace_rule"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "user_notification_workspace_project" ADD CONSTRAINT "user_notification_workspace_project_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "user_notification_workspace_rule" ADD CONSTRAINT "user_notification_workspace_rule_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+ALTER TABLE "user_notification_workspace_rule" ADD CONSTRAINT "user_notification_workspace_rule_workspace_id_workspace_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspace"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint
+CREATE INDEX "user_notification_workspace_project_ruleId_idx" ON "user_notification_workspace_project" USING btree ("workspace_rule_id");--> statement-breakpoint
+CREATE INDEX "user_notification_workspace_project_projectId_idx" ON "user_notification_workspace_project" USING btree ("project_id");--> statement-breakpoint
+CREATE INDEX "user_notification_workspace_rule_userId_idx" ON "user_notification_workspace_rule" USING btree ("user_id");--> statement-breakpoint
+CREATE INDEX "user_notification_workspace_rule_workspaceId_idx" ON "user_notification_workspace_rule" USING btree ("workspace_id");
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0020_snapshot.json b/apps/api/drizzle/meta/0020_snapshot.json
new file mode 100644
index 000000000..e26da3957
--- /dev/null
+++ b/apps/api/drizzle/meta/0020_snapshot.json
@@ -0,0 +1,2854 @@
+{
+ "id": "745512c9-3ace-4437-abaf-697e303b6d2a",
+ "prevId": "355507ff-3b8c-46d7-b93a-6ef124d03692",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.activity": {
+ "name": "activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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": {},
+ "foreignKeys": {
+ "activity_task_id_task_id_fk": {
+ "name": "activity_task_id_task_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "activity_user_id_user_id_fk": {
+ "name": "activity_user_id_user_id_fk",
+ "tableFrom": "activity",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "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": {}
+ }
+ },
+ "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.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": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_workspace_id_workspace_id_fk": {
+ "name": "invitation_workspace_id_workspace_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": ["inviter_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "task_id": {
+ "name": "task_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_task_id_task_id_fk": {
+ "name": "label_task_id_task_id_fk",
+ "tableFrom": "label",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "label_workspace_id_workspace_id_fk": {
+ "name": "label_workspace_id_workspace_id_fk",
+ "tableFrom": "label",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": 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()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'Layout'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "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": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_team_id": {
+ "name": "active_team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": ["token"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.task_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": {
+ "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()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_project_id_project_id_fk": {
+ "name": "task_project_id_project_id_fk",
+ "tableFrom": "task",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_column_id_column_id_fk": {
+ "name": "task_column_id_column_id_fk",
+ "tableFrom": "task",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "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()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "time_entry_task_id_task_id_fk": {
+ "name": "time_entry_task_id_task_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "task",
+ "columnsFrom": ["task_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "time_entry_user_id_user_id_fk": {
+ "name": "time_entry_user_id_user_id_fk",
+ "tableFrom": "time_entry",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "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
+ }
+ },
+ "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": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "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
+ },
+ "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
+ },
+ "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": {},
+ "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_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()"
+ }
+ },
+ "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": {}
+ }
+ },
+ "foreignKeys": {
+ "user_notification_workspace_project_workspace_rule_id_user_notification_workspace_rule_id_fk": {
+ "name": "user_notification_workspace_project_workspace_rule_id_user_notification_workspace_rule_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "user_notification_workspace_rule",
+ "columnsFrom": ["workspace_rule_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "user_notification_workspace_project_project_id_project_id_fk": {
+ "name": "user_notification_workspace_project_project_id_project_id_fk",
+ "tableFrom": "user_notification_workspace_project",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["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
+ },
+ "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"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workflow_rule": {
+ "name": "workflow_rule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_type": {
+ "name": "integration_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workflow_rule_projectId_idx": {
+ "name": "workflow_rule_projectId_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workflow_rule_project_id_project_id_fk": {
+ "name": "workflow_rule_project_id_project_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "project",
+ "columnsFrom": ["project_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "workflow_rule_column_id_column_id_fk": {
+ "name": "workflow_rule_column_id_column_id_fk",
+ "tableFrom": "workflow_rule",
+ "tableTo": "column",
+ "columnsFrom": ["column_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "workspace_slug_unique": {
+ "name": "workspace_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": ["slug"]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_member": {
+ "name": "workspace_member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "workspace_member_workspaceId_idx": {
+ "name": "workspace_member_workspaceId_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_member_userId_idx": {
+ "name": "workspace_member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_member_workspace_id_workspace_id_fk": {
+ "name": "workspace_member_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_member_user_id_user_id_fk": {
+ "name": "workspace_member_user_id_user_id_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json
index 37f81d76c..7f4e8b1e8 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -141,6 +141,13 @@
"when": 1774823200346,
"tag": "0019_sloppy_meteorite",
"breakpoints": true
+ },
+ {
+ "idx": 20,
+ "version": "7",
+ "when": 1775035770523,
+ "tag": "0020_careful_shiver_man",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/index.ts b/apps/api/src/database/index.ts
index 35a026a3a..7587a0d3e 100644
--- a/apps/api/src/database/index.ts
+++ b/apps/api/src/database/index.ts
@@ -22,6 +22,9 @@ import {
teamTableRelations,
timeEntryTableRelations,
userTableRelations,
+ userNotificationPreferenceTableRelations,
+ userNotificationWorkspaceProjectTableRelations,
+ userNotificationWorkspaceRuleTableRelations,
verificationTableRelations,
workflowRuleTableRelations,
workspaceTableRelations,
@@ -48,6 +51,9 @@ import {
teamTable,
timeEntryTable,
userTable,
+ userNotificationPreferenceTable,
+ userNotificationWorkspaceProjectTable,
+ userNotificationWorkspaceRuleTable,
verificationTable,
workflowRuleTable,
workspaceTable,
@@ -83,6 +89,9 @@ export const schema = {
teamTable,
timeEntryTable,
userTable,
+ userNotificationPreferenceTable,
+ userNotificationWorkspaceProjectTable,
+ userNotificationWorkspaceRuleTable,
verificationTable,
workflowRuleTable,
workspaceTable,
@@ -107,6 +116,9 @@ export const schema = {
teamTableRelations,
timeEntryTableRelations,
userTableRelations,
+ userNotificationPreferenceTableRelations,
+ userNotificationWorkspaceProjectTableRelations,
+ userNotificationWorkspaceRuleTableRelations,
verificationTableRelations,
workflowRuleTableRelations,
workspaceTableRelations,
diff --git a/apps/api/src/database/relations.ts b/apps/api/src/database/relations.ts
index 9c6dcb182..9d57a9d78 100644
--- a/apps/api/src/database/relations.ts
+++ b/apps/api/src/database/relations.ts
@@ -20,6 +20,9 @@ import {
teamTable,
timeEntryTable,
userTable,
+ userNotificationPreferenceTable,
+ userNotificationWorkspaceProjectTable,
+ userNotificationWorkspaceRuleTable,
verificationTable,
workflowRuleTable,
workspaceTable,
@@ -38,6 +41,8 @@ export const userTableRelations = relations(userTable, ({ many }) => ({
comments: many(commentTable),
assets: many(assetTable),
notifications: many(notificationTable),
+ notificationPreference: many(userNotificationPreferenceTable),
+ notificationWorkspaceRules: many(userNotificationWorkspaceRuleTable),
sentInvitations: many(invitationTable),
apikeys: many(apikeyTable),
}));
@@ -69,6 +74,7 @@ export const workspaceTableRelations = relations(
projects: many(projectTable),
assets: many(assetTable),
invitations: many(invitationTable),
+ notificationWorkspaceRules: many(userNotificationWorkspaceRuleTable),
}),
);
@@ -99,6 +105,7 @@ export const projectTableRelations = relations(
workflowRules: many(workflowRuleTable),
githubIntegration: many(githubIntegrationTable),
integrations: many(integrationTable),
+ notificationWorkspaceProjects: many(userNotificationWorkspaceProjectTable),
}),
);
@@ -210,6 +217,45 @@ export const notificationTableRelations = relations(
}),
);
+export const userNotificationPreferenceTableRelations = relations(
+ userNotificationPreferenceTable,
+ ({ one }) => ({
+ user: one(userTable, {
+ fields: [userNotificationPreferenceTable.userId],
+ references: [userTable.id],
+ }),
+ }),
+);
+
+export const userNotificationWorkspaceRuleTableRelations = relations(
+ userNotificationWorkspaceRuleTable,
+ ({ one, many }) => ({
+ user: one(userTable, {
+ fields: [userNotificationWorkspaceRuleTable.userId],
+ references: [userTable.id],
+ }),
+ workspace: one(workspaceTable, {
+ fields: [userNotificationWorkspaceRuleTable.workspaceId],
+ references: [workspaceTable.id],
+ }),
+ selectedProjects: many(userNotificationWorkspaceProjectTable),
+ }),
+);
+
+export const userNotificationWorkspaceProjectTableRelations = relations(
+ userNotificationWorkspaceProjectTable,
+ ({ one }) => ({
+ workspaceRule: one(userNotificationWorkspaceRuleTable, {
+ fields: [userNotificationWorkspaceProjectTable.workspaceRuleId],
+ references: [userNotificationWorkspaceRuleTable.id],
+ }),
+ project: one(projectTable, {
+ fields: [userNotificationWorkspaceProjectTable.projectId],
+ references: [projectTable.id],
+ }),
+ }),
+);
+
export const githubIntegrationTableRelations = relations(
githubIntegrationTable,
({ one }) => ({
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index e46fcef0e..ae4ac4fa7 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -429,6 +429,103 @@ export const notificationTable = pgTable("notification", {
.notNull(),
});
+export const userNotificationPreferenceTable = pgTable("user_notification_preference", {
+ userId: text("user_id")
+ .primaryKey()
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ emailEnabled: boolean("email_enabled").default(false).notNull(),
+ ntfyEnabled: boolean("ntfy_enabled").default(false).notNull(),
+ ntfyServerUrl: text("ntfy_server_url"),
+ ntfyTopic: text("ntfy_topic"),
+ ntfyToken: text("ntfy_token"),
+ webhookEnabled: boolean("webhook_enabled").default(false).notNull(),
+ webhookUrl: text("webhook_url"),
+ webhookSecret: text("webhook_secret"),
+ createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ updatedAt: timestamp("updated_at", { mode: "date" })
+ .defaultNow()
+ .$onUpdate(() => new Date())
+ .notNull(),
+});
+
+export const userNotificationWorkspaceRuleTable = pgTable(
+ "user_notification_workspace_rule",
+ {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ userId: text("user_id")
+ .notNull()
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ workspaceId: text("workspace_id")
+ .notNull()
+ .references(() => workspaceTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ isActive: boolean("is_active").default(true).notNull(),
+ emailEnabled: boolean("email_enabled").default(false).notNull(),
+ ntfyEnabled: boolean("ntfy_enabled").default(false).notNull(),
+ webhookEnabled: boolean("webhook_enabled").default(false).notNull(),
+ projectMode: text("project_mode").default("all").notNull(),
+ createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ updatedAt: timestamp("updated_at", { mode: "date" })
+ .defaultNow()
+ .$onUpdate(() => new Date())
+ .notNull(),
+ },
+ (table) => [
+ index("user_notification_workspace_rule_userId_idx").on(table.userId),
+ index("user_notification_workspace_rule_workspaceId_idx").on(
+ table.workspaceId,
+ ),
+ unique("user_notification_workspace_rule_user_workspace_unique").on(
+ table.userId,
+ table.workspaceId,
+ ),
+ ],
+);
+
+export const userNotificationWorkspaceProjectTable = pgTable(
+ "user_notification_workspace_project",
+ {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ workspaceRuleId: text("workspace_rule_id")
+ .notNull()
+ .references(() => userNotificationWorkspaceRuleTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ projectId: text("project_id")
+ .notNull()
+ .references(() => projectTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ createdAt: timestamp("created_at", { mode: "date" }).defaultNow().notNull(),
+ },
+ (table) => [
+ index("user_notification_workspace_project_ruleId_idx").on(
+ table.workspaceRuleId,
+ ),
+ index("user_notification_workspace_project_projectId_idx").on(
+ table.projectId,
+ ),
+ unique("user_notification_workspace_project_rule_project_unique").on(
+ table.workspaceRuleId,
+ table.projectId,
+ ),
+ ],
+);
+
export const githubIntegrationTable = pgTable("github_integration", {
id: text("id")
.$defaultFn(() => createId())
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index cbaa8cd2e..021ed302b 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -28,6 +28,7 @@ import invitation from "./invitation";
import label from "./label";
import { migrateColumns } from "./migrations/column-migration";
import notification from "./notification";
+import notificationPreferences from "./notification-preferences";
import { initializePlugins } from "./plugins";
import { migrateGitHubIntegration } from "./plugins/github/migration";
import project from "./project";
@@ -393,6 +394,10 @@ const commentApi = api.route("/comment", comment);
const timeEntryApi = api.route("/time-entry", timeEntry);
const labelApi = api.route("/label", label);
const notificationApi = api.route("/notification", notification);
+const notificationPreferencesApi = api.route(
+ "/notification-preferences",
+ notificationPreferences,
+);
const searchApi = api.route("/search", search);
const githubIntegrationApi = api.route(
"/github-integration",
@@ -459,6 +464,7 @@ export type AppType =
| typeof timeEntryApi
| typeof labelApi
| typeof notificationApi
+ | typeof notificationPreferencesApi
| typeof searchApi
| typeof githubIntegrationApi
| typeof genericWebhookIntegrationApi
diff --git a/apps/api/src/notification-preferences/delivery.ts b/apps/api/src/notification-preferences/delivery.ts
new file mode 100644
index 000000000..0985ddce0
--- /dev/null
+++ b/apps/api/src/notification-preferences/delivery.ts
@@ -0,0 +1,437 @@
+import { createHmac } from "node:crypto";
+import { sendNotificationEmail } from "@kaneo/email";
+import { and, eq, inArray } from "drizzle-orm";
+import db from "../database";
+import {
+ notificationTable,
+ projectTable,
+ taskTable,
+ userNotificationPreferenceTable,
+ userNotificationWorkspaceProjectTable,
+ userNotificationWorkspaceRuleTable,
+ userTable,
+ workspaceTable,
+} from "../database/schema";
+import { assertPublicWebhookDestination } from "../plugins/generic-webhook/config";
+
+type ResolvedNotificationContext = {
+ workspaceId: string;
+ workspaceName: string;
+ projectId: string | null;
+ projectName: string | null;
+ taskId: string | null;
+ taskTitle: string | null;
+ taskUrl: string | null;
+};
+
+type DeliveryContent = {
+ title: string;
+ body: string;
+};
+
+function buildTaskUrl(workspaceId: string, projectId: string, taskId: string) {
+ const clientUrl = process.env.KANEO_CLIENT_URL || "http://localhost:5173";
+ return `${clientUrl}/dashboard/workspace/${workspaceId}/project/${projectId}/task/${taskId}`;
+}
+
+function getStringValue(
+ data: Record<string, unknown> | null | undefined,
+ key: string,
+) {
+ const value = data?.[key];
+ return typeof value === "string" ? value : null;
+}
+
+function buildDeliveryContent(notification: {
+ type: string;
+ content: string | null;
+ title: string | null;
+ eventData: Record<string, unknown> | null;
+}): DeliveryContent {
+ if (notification.title && notification.content) {
+ return {
+ title: notification.title,
+ body: notification.content,
+ };
+ }
+
+ switch (notification.type) {
+ case "task_created": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ return {
+ title: "New task created",
+ body: taskTitle
+ ? `A new task was created: ${taskTitle}`
+ : "A new task was created in Kaneo.",
+ };
+ }
+ case "workspace_created": {
+ const workspaceName = getStringValue(
+ notification.eventData,
+ "workspaceName",
+ );
+ return {
+ title: "Workspace created",
+ body: workspaceName
+ ? `Workspace created: ${workspaceName}`
+ : "A new workspace was created in Kaneo.",
+ };
+ }
+ case "task_status_changed": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ const oldStatus = getStringValue(notification.eventData, "oldStatus");
+ const newStatus = getStringValue(notification.eventData, "newStatus");
+ return {
+ title: "Task status changed",
+ body:
+ taskTitle && oldStatus && newStatus
+ ? `${taskTitle} moved from ${oldStatus} to ${newStatus}.`
+ : "A task status changed in Kaneo.",
+ };
+ }
+ case "task_assignee_changed": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ return {
+ title: "Task assigned to you",
+ body: taskTitle
+ ? `You were assigned to ${taskTitle}.`
+ : "A task was assigned to you in Kaneo.",
+ };
+ }
+ case "time_entry_created": {
+ const taskTitle = getStringValue(notification.eventData, "taskTitle");
+ return {
+ title: "Time entry created",
+ body: taskTitle
+ ? `A time entry was created for ${taskTitle}.`
+ : "A time entry was created in Kaneo.",
+ };
+ }
+ default:
+ return {
+ title: notification.title ?? "New Kaneo notification",
+ body: notification.content ?? "You have a new notification in Kaneo.",
+ };
+ }
+}
+
+async function resolveNotificationContext(notification: {
+ resourceType: string | null;
+ resourceId: string | null;
+}): Promise<ResolvedNotificationContext | null> {
+ if (!notification.resourceType || !notification.resourceId) {
+ return null;
+ }
+
+ if (notification.resourceType === "task") {
+ const [task] = await db
+ .select({
+ taskId: taskTable.id,
+ taskTitle: taskTable.title,
+ projectId: projectTable.id,
+ projectName: projectTable.name,
+ workspaceId: workspaceTable.id,
+ workspaceName: workspaceTable.name,
+ })
+ .from(taskTable)
+ .innerJoin(projectTable, eq(taskTable.projectId, projectTable.id))
+ .innerJoin(
+ workspaceTable,
+ eq(projectTable.workspaceId, workspaceTable.id),
+ )
+ .where(eq(taskTable.id, notification.resourceId))
+ .limit(1);
+
+ if (!task) {
+ return null;
+ }
+
+ return {
+ workspaceId: task.workspaceId,
+ workspaceName: task.workspaceName,
+ projectId: task.projectId,
+ projectName: task.projectName,
+ taskId: task.taskId,
+ taskTitle: task.taskTitle,
+ taskUrl: buildTaskUrl(task.workspaceId, task.projectId, task.taskId),
+ };
+ }
+
+ if (notification.resourceType === "workspace") {
+ const [workspace] = await db
+ .select({
+ workspaceId: workspaceTable.id,
+ workspaceName: workspaceTable.name,
+ })
+ .from(workspaceTable)
+ .where(eq(workspaceTable.id, notification.resourceId))
+ .limit(1);
+
+ if (!workspace) {
+ return null;
+ }
+
+ return {
+ workspaceId: workspace.workspaceId,
+ workspaceName: workspace.workspaceName,
+ projectId: null,
+ projectName: null,
+ taskId: null,
+ taskTitle: null,
+ taskUrl: null,
+ };
+ }
+
+ return null;
+}
+
+async function sendNtfyNotification(input: {
+ serverUrl: string;
+ topic: string;
+ token?: string | null;
+ title: string;
+ body: string;
+ clickUrl?: string | null;
+}) {
+ await assertPublicWebhookDestination(input.serverUrl);
+
+ const response = await fetch(
+ `${input.serverUrl.replace(/\/+$/, "")}/${encodeURIComponent(input.topic)}`,
+ {
+ method: "POST",
+ headers: {
+ ...(input.token ? { Authorization: `Bearer ${input.token}` } : {}),
+ ...(input.clickUrl ? { Click: input.clickUrl } : {}),
+ Title: input.title,
+ },
+ body: input.body,
+ },
+ );
+
+ if (!response.ok) {
+ throw new Error(
+ `ntfy delivery failed (${response.status}): ${await response.text()}`,
+ );
+ }
+}
+
+async function sendWebhookNotification(input: {
+ webhookUrl: string;
+ secret?: string | null;
+ payload: Record<string, unknown>;
+}) {
+ await assertPublicWebhookDestination(input.webhookUrl);
+
+ const body = JSON.stringify(input.payload);
+ const headers: Record<string, string> = {
+ "Content-Type": "application/json",
+ };
+
+ if (input.secret) {
+ headers["X-Kaneo-Signature"] = createHmac("sha256", input.secret)
+ .update(body)
+ .digest("hex");
+ }
+
+ const response = await fetch(input.webhookUrl, {
+ method: "POST",
+ headers,
+ body,
+ });
+
+ if (!response.ok) {
+ throw new Error(
+ `Webhook delivery failed (${response.status}): ${await response.text()}`,
+ );
+ }
+}
+
+export async function deliverNotification(
+ notificationId: string,
+): Promise<void> {
+ const notification = await db.query.notificationTable.findFirst({
+ where: eq(notificationTable.id, notificationId),
+ });
+
+ if (!notification) {
+ return;
+ }
+
+ const context = await resolveNotificationContext(notification);
+ if (!context) {
+ return;
+ }
+
+ const [user] = await db
+ .select({
+ email: userTable.email,
+ name: userTable.name,
+ locale: userTable.locale,
+ })
+ .from(userTable)
+ .where(eq(userTable.id, notification.userId))
+ .limit(1);
+
+ if (!user) {
+ return;
+ }
+
+ const preference = await db.query.userNotificationPreferenceTable.findFirst({
+ where: eq(userNotificationPreferenceTable.userId, notification.userId),
+ });
+
+ if (!preference) {
+ return;
+ }
+
+ const rule = await db.query.userNotificationWorkspaceRuleTable.findFirst({
+ where: and(
+ eq(userNotificationWorkspaceRuleTable.userId, notification.userId),
+ eq(userNotificationWorkspaceRuleTable.workspaceId, context.workspaceId),
+ ),
+ with: {
+ selectedProjects: true,
+ },
+ });
+
+ if (!rule?.isActive) {
+ return;
+ }
+
+ if (
+ context.projectId &&
+ rule.projectMode === "selected" &&
+ !rule.selectedProjects.some(
+ (project) => project.projectId === context.projectId,
+ )
+ ) {
+ return;
+ }
+
+ const content = buildDeliveryContent({
+ type: notification.type,
+ title: notification.title ?? null,
+ content: notification.content ?? null,
+ eventData:
+ notification.eventData && typeof notification.eventData === "object"
+ ? (notification.eventData as Record<string, unknown>)
+ : null,
+ });
+
+ const webhookPayload = {
+ notification: {
+ id: notification.id,
+ type: notification.type,
+ title: content.title,
+ content: content.body,
+ createdAt: notification.createdAt,
+ eventData: notification.eventData,
+ resourceId: notification.resourceId,
+ resourceType: notification.resourceType,
+ },
+ workspace: {
+ id: context.workspaceId,
+ name: context.workspaceName,
+ },
+ project: context.projectId
+ ? {
+ id: context.projectId,
+ name: context.projectName,
+ }
+ : null,
+ task: context.taskId
+ ? {
+ id: context.taskId,
+ title: context.taskTitle,
+ url: context.taskUrl,
+ }
+ : null,
+ user: {
+ id: notification.userId,
+ email: user.email,
+ name: user.name,
+ },
+ };
+
+ const deliveries: Array<Promise<void>> = [];
+
+ if (preference.emailEnabled && rule.emailEnabled && user.email) {
+ deliveries.push(
+ sendNotificationEmail(user.email, content.title, {
+ title: content.title,
+ message: content.body,
+ actionUrl: context.taskUrl,
+ actionLabel: context.taskUrl ? "Open in Kaneo" : undefined,
+ locale: user.locale ?? null,
+ }),
+ );
+ }
+
+ if (
+ preference.ntfyEnabled &&
+ preference.ntfyServerUrl &&
+ preference.ntfyTopic &&
+ rule.ntfyEnabled
+ ) {
+ deliveries.push(
+ sendNtfyNotification({
+ serverUrl: preference.ntfyServerUrl,
+ topic: preference.ntfyTopic,
+ token: preference.ntfyToken,
+ title: content.title,
+ body: content.body,
+ clickUrl: context.taskUrl,
+ }),
+ );
+ }
+
+ if (
+ preference.webhookEnabled &&
+ preference.webhookUrl &&
+ rule.webhookEnabled
+ ) {
+ deliveries.push(
+ sendWebhookNotification({
+ webhookUrl: preference.webhookUrl,
+ secret: preference.webhookSecret,
+ payload: webhookPayload,
+ }),
+ );
+ }
+
+ const results = await Promise.allSettled(deliveries);
+ for (const result of results) {
+ if (result.status === "rejected") {
+ console.error("Notification delivery failed", {
+ notificationId,
+ error: result.reason,
+ });
+ }
+ }
+}
+
+export async function hasSelectedProjects(
+ userId: string,
+ workspaceId: string,
+ projectIds: string[],
+) {
+ const rows = await db
+ .select({ projectId: userNotificationWorkspaceProjectTable.projectId })
+ .from(userNotificationWorkspaceProjectTable)
+ .innerJoin(
+ userNotificationWorkspaceRuleTable,
+ eq(
+ userNotificationWorkspaceProjectTable.workspaceRuleId,
+ userNotificationWorkspaceRuleTable.id,
+ ),
+ )
+ .where(
+ and(
+ eq(userNotificationWorkspaceRuleTable.userId, userId),
+ eq(userNotificationWorkspaceRuleTable.workspaceId, workspaceId),
+ inArray(userNotificationWorkspaceProjectTable.projectId, projectIds),
+ ),
+ );
+
+ return rows.length > 0;
+}
diff --git a/apps/api/src/notification-preferences/index.ts b/apps/api/src/notification-preferences/index.ts
new file mode 100644
index 000000000..711fba234
--- /dev/null
+++ b/apps/api/src/notification-preferences/index.ts
@@ -0,0 +1,153 @@
+import { Hono } from "hono";
+import { describeRoute, resolver, validator } from "hono-openapi";
+import * as v from "valibot";
+import { notificationPreferenceSchema } from "../schemas";
+import {
+ deleteWorkspaceRule,
+ getNotificationPreferences,
+ updateNotificationPreferences,
+ upsertWorkspaceRule,
+} from "./service";
+
+const workspaceRuleSchema = v.object({
+ isActive: v.boolean(),
+ emailEnabled: v.boolean(),
+ ntfyEnabled: v.boolean(),
+ webhookEnabled: v.boolean(),
+ projectMode: v.picklist(["all", "selected"] as const),
+ selectedProjectIds: v.optional(v.array(v.string())),
+});
+
+const notificationPreferences = new Hono<{
+ Variables: {
+ userId: string;
+ userEmail: string;
+ };
+}>();
+
+notificationPreferences
+ .get(
+ "/",
+ describeRoute({
+ operationId: "getNotificationPreferences",
+ tags: ["Notification Preferences"],
+ description: "Get notification delivery preferences for the current user",
+ responses: {
+ 200: {
+ description: "Notification preferences",
+ content: {
+ "application/json": {
+ schema: resolver(notificationPreferenceSchema),
+ },
+ },
+ },
+ },
+ }),
+ async (c) => {
+ const userId = c.get("userId");
+ const userEmail = c.get("userEmail");
+ return c.json(
+ await getNotificationPreferences(userId, userEmail || null),
+ );
+ },
+ )
+ .put(
+ "/",
+ describeRoute({
+ operationId: "updateNotificationPreferences",
+ tags: ["Notification Preferences"],
+ description: "Update global notification delivery preferences",
+ responses: {
+ 200: {
+ description: "Updated notification preferences",
+ content: {
+ "application/json": {
+ schema: resolver(notificationPreferenceSchema),
+ },
+ },
+ },
+ },
+ }),
+ validator(
+ "json",
+ v.object({
+ emailEnabled: v.optional(v.boolean()),
+ ntfyEnabled: v.optional(v.boolean()),
+ ntfyServerUrl: v.optional(v.nullable(v.string())),
+ ntfyTopic: v.optional(v.nullable(v.string())),
+ ntfyToken: v.optional(v.nullable(v.string())),
+ webhookEnabled: v.optional(v.boolean()),
+ webhookUrl: v.optional(v.nullable(v.string())),
+ webhookSecret: v.optional(v.nullable(v.string())),
+ }),
+ ),
+ async (c) => {
+ const userId = c.get("userId");
+ const userEmail = c.get("userEmail");
+ const body = c.req.valid("json");
+
+ return c.json(
+ await updateNotificationPreferences(userId, userEmail || null, body),
+ );
+ },
+ )
+ .put(
+ "/workspaces/:workspaceId",
+ describeRoute({
+ operationId: "upsertNotificationPreferenceWorkspaceRule",
+ tags: ["Notification Preferences"],
+ description: "Create or update a workspace notification rule",
+ responses: {
+ 200: {
+ description: "Updated notification preferences",
+ content: {
+ "application/json": {
+ schema: resolver(notificationPreferenceSchema),
+ },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ workspaceId: v.string() })),
+ validator("json", workspaceRuleSchema),
+ async (c) => {
+ const userId = c.get("userId");
+ const userEmail = c.get("userEmail");
+ const { workspaceId } = c.req.valid("param");
+ const body = c.req.valid("json");
+
+ return c.json(
+ await upsertWorkspaceRule(userId, workspaceId, userEmail || null, body),
+ );
+ },
+ )
+ .delete(
+ "/workspaces/:workspaceId",
+ describeRoute({
+ operationId: "deleteNotificationPreferenceWorkspaceRule",
+ tags: ["Notification Preferences"],
+ description: "Delete a workspace notification rule",
+ responses: {
+ 200: {
+ description: "Updated notification preferences",
+ content: {
+ "application/json": {
+ schema: resolver(notificationPreferenceSchema),
+ },
+ },
+ },
+ },
+ }),
+ validator("param", v.object({ workspaceId: v.string() })),
+ async (c) => {
+ const userId = c.get("userId");
+ const userEmail = c.get("userEmail");
+ const { workspaceId } = c.req.valid("param");
+
+ return c.json(
+ await deleteWorkspaceRule(userId, workspaceId, userEmail || null),
+ );
+ },
+ );
+
+export default notificationPreferences;
diff --git a/apps/api/src/notification-preferences/service.ts b/apps/api/src/notification-preferences/service.ts
new file mode 100644
index 000000000..3312f17c0
--- /dev/null
+++ b/apps/api/src/notification-preferences/service.ts
@@ -0,0 +1,448 @@
+import { and, eq, inArray } from "drizzle-orm";
+import { HTTPException } from "hono/http-exception";
+import db from "../database";
+import {
+ projectTable,
+ userNotificationPreferenceTable,
+ userNotificationWorkspaceProjectTable,
+ userNotificationWorkspaceRuleTable,
+ workspaceUserTable,
+} from "../database/schema";
+import { assertPublicWebhookDestination } from "../plugins/generic-webhook/config";
+
+export type NotificationPreferenceProjectMode = "all" | "selected";
+
+export type NotificationPreferenceResponse = {
+ emailAddress: string | null;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ ntfyConfigured: boolean;
+ ntfyServerUrl: string | null;
+ ntfyTopic: string | null;
+ ntfyTokenConfigured: boolean;
+ maskedNtfyToken: string | null;
+ webhookEnabled: boolean;
+ webhookConfigured: boolean;
+ webhookUrl: string | null;
+ webhookSecretConfigured: boolean;
+ maskedWebhookSecret: string | null;
+ workspaces: Array<{
+ id: string;
+ workspaceId: string;
+ workspaceName: string;
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: NotificationPreferenceProjectMode;
+ selectedProjectIds: string[];
+ createdAt: Date;
+ updatedAt: Date;
+ }>;
+ createdAt: Date | null;
+ updatedAt: Date | null;
+};
+
+export type UpdateNotificationPreferenceInput = {
+ emailEnabled?: boolean;
+ ntfyEnabled?: boolean;
+ ntfyServerUrl?: string | null;
+ ntfyTopic?: string | null;
+ ntfyToken?: string | null;
+ webhookEnabled?: boolean;
+ webhookUrl?: string | null;
+ webhookSecret?: string | null;
+};
+
+export type UpsertWorkspaceRuleInput = {
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: NotificationPreferenceProjectMode;
+ selectedProjectIds?: string[];
+};
+
+function normalizeOptionalString(value: string | null | undefined) {
+ if (typeof value !== "string") {
+ return value === null ? null : undefined;
+ }
+
+ const trimmed = value.trim();
+ return trimmed.length > 0 ? trimmed : null;
+}
+
+function maskValue(value: string | undefined | null): string | null {
+ if (!value) return null;
+ return value.length > 8 ? `${value.slice(0, 4)}…${value.slice(-4)}` : "••••";
+}
+
+async function assertWorkspaceMembership(userId: string, workspaceId: string) {
+ const [membership] = await db
+ .select({ workspaceId: workspaceUserTable.workspaceId })
+ .from(workspaceUserTable)
+ .where(
+ and(
+ eq(workspaceUserTable.userId, userId),
+ eq(workspaceUserTable.workspaceId, workspaceId),
+ ),
+ )
+ .limit(1);
+
+ if (!membership) {
+ throw new HTTPException(403, {
+ message: "You don't have access to this workspace",
+ });
+ }
+}
+
+export async function validateProjectSelection(
+ workspaceId: string,
+ selectedProjectIds: string[],
+) {
+ if (selectedProjectIds.length === 0) {
+ throw new HTTPException(400, {
+ message: "Select at least one project for selected project mode",
+ });
+ }
+
+ const projects = await db
+ .select({ id: projectTable.id })
+ .from(projectTable)
+ .where(
+ and(
+ eq(projectTable.workspaceId, workspaceId),
+ inArray(projectTable.id, selectedProjectIds),
+ ),
+ );
+
+ if (projects.length !== selectedProjectIds.length) {
+ throw new HTTPException(400, {
+ message: "One or more selected projects are invalid",
+ });
+ }
+}
+
+export async function getNotificationPreferences(
+ userId: string,
+ emailAddress: string | null,
+): Promise<NotificationPreferenceResponse> {
+ const preference = await db.query.userNotificationPreferenceTable.findFirst({
+ where: eq(userNotificationPreferenceTable.userId, userId),
+ });
+
+ const rules = await db.query.userNotificationWorkspaceRuleTable.findMany({
+ where: eq(userNotificationWorkspaceRuleTable.userId, userId),
+ with: {
+ workspace: true,
+ selectedProjects: true,
+ },
+ orderBy: (table, { asc }) => [asc(table.createdAt)],
+ });
+
+ return {
+ emailAddress,
+ emailEnabled: preference?.emailEnabled ?? false,
+ ntfyEnabled: preference?.ntfyEnabled ?? false,
+ ntfyConfigured: Boolean(preference?.ntfyServerUrl && preference?.ntfyTopic),
+ ntfyServerUrl: preference?.ntfyServerUrl ?? null,
+ ntfyTopic: preference?.ntfyTopic ?? null,
+ ntfyTokenConfigured: Boolean(preference?.ntfyToken),
+ maskedNtfyToken: maskValue(preference?.ntfyToken),
+ webhookEnabled: preference?.webhookEnabled ?? false,
+ webhookConfigured: Boolean(preference?.webhookUrl),
+ webhookUrl: preference?.webhookUrl ?? null,
+ webhookSecretConfigured: Boolean(preference?.webhookSecret),
+ maskedWebhookSecret: maskValue(preference?.webhookSecret),
+ workspaces: rules.map((rule) => ({
+ id: rule.id,
+ workspaceId: rule.workspaceId,
+ workspaceName: rule.workspace.name,
+ isActive: rule.isActive ?? true,
+ emailEnabled: rule.emailEnabled ?? false,
+ ntfyEnabled: rule.ntfyEnabled ?? false,
+ webhookEnabled: rule.webhookEnabled ?? false,
+ projectMode:
+ rule.projectMode === "selected" ? "selected" : ("all" as const),
+ selectedProjectIds: rule.selectedProjects.map(
+ (project) => project.projectId,
+ ),
+ createdAt: rule.createdAt,
+ updatedAt: rule.updatedAt,
+ })),
+ createdAt: preference?.createdAt ?? null,
+ updatedAt: preference?.updatedAt ?? null,
+ };
+}
+
+export async function updateNotificationPreferences(
+ userId: string,
+ emailAddress: string | null,
+ input: UpdateNotificationPreferenceInput,
+): Promise<NotificationPreferenceResponse> {
+ const existing = await db.query.userNotificationPreferenceTable.findFirst({
+ where: eq(userNotificationPreferenceTable.userId, userId),
+ });
+
+ const ntfyServerUrl = normalizeOptionalString(
+ input.ntfyServerUrl ?? existing?.ntfyServerUrl,
+ );
+ const ntfyTopic = normalizeOptionalString(
+ input.ntfyTopic ?? existing?.ntfyTopic,
+ );
+ const ntfyToken = normalizeOptionalString(input.ntfyToken ?? undefined);
+ const webhookUrl = normalizeOptionalString(
+ input.webhookUrl ?? existing?.webhookUrl,
+ );
+ const webhookSecret = normalizeOptionalString(
+ input.webhookSecret ?? undefined,
+ );
+
+ const emailEnabled = input.emailEnabled ?? existing?.emailEnabled ?? false;
+ const ntfyEnabled = input.ntfyEnabled ?? existing?.ntfyEnabled ?? false;
+ const webhookEnabled =
+ input.webhookEnabled ?? existing?.webhookEnabled ?? false;
+
+ if (emailEnabled && !emailAddress) {
+ throw new HTTPException(400, {
+ message: "Email notifications require an account email address",
+ });
+ }
+
+ if (ntfyEnabled || ntfyServerUrl || ntfyTopic || ntfyToken !== undefined) {
+ if (!ntfyServerUrl || !ntfyTopic) {
+ throw new HTTPException(400, {
+ message: "ntfy requires a server URL and topic",
+ });
+ }
+
+ try {
+ new URL(ntfyServerUrl);
+ await assertPublicWebhookDestination(ntfyServerUrl);
+ } catch (error) {
+ throw new HTTPException(400, {
+ message:
+ error instanceof Error ? error.message : "Invalid ntfy server URL",
+ });
+ }
+ }
+
+ if (webhookEnabled || webhookUrl || webhookSecret !== undefined) {
+ if (!webhookUrl) {
+ throw new HTTPException(400, {
+ message: "Webhook notifications require an endpoint URL",
+ });
+ }
+
+ try {
+ new URL(webhookUrl);
+ await assertPublicWebhookDestination(webhookUrl);
+ } catch (error) {
+ throw new HTTPException(400, {
+ message: error instanceof Error ? error.message : "Invalid webhook URL",
+ });
+ }
+ }
+
+ const data = {
+ userId,
+ emailEnabled,
+ ntfyEnabled,
+ ntfyServerUrl,
+ ntfyTopic,
+ ntfyToken:
+ ntfyToken === undefined ? (existing?.ntfyToken ?? null) : ntfyToken,
+ webhookEnabled,
+ webhookUrl,
+ webhookSecret:
+ webhookSecret === undefined
+ ? (existing?.webhookSecret ?? null)
+ : webhookSecret,
+ };
+
+ if (existing) {
+ await db
+ .update(userNotificationPreferenceTable)
+ .set({
+ ...data,
+ updatedAt: new Date(),
+ })
+ .where(eq(userNotificationPreferenceTable.userId, userId));
+ } else {
+ await db.insert(userNotificationPreferenceTable).values(data);
+ }
+
+ if (!emailEnabled) {
+ await db
+ .update(userNotificationWorkspaceRuleTable)
+ .set({ emailEnabled: false, updatedAt: new Date() })
+ .where(eq(userNotificationWorkspaceRuleTable.userId, userId));
+ }
+
+ if (!ntfyEnabled || !ntfyServerUrl || !ntfyTopic) {
+ await db
+ .update(userNotificationWorkspaceRuleTable)
+ .set({ ntfyEnabled: false, updatedAt: new Date() })
+ .where(eq(userNotificationWorkspaceRuleTable.userId, userId));
+ }
+
+ if (!webhookEnabled || !webhookUrl) {
+ await db
+ .update(userNotificationWorkspaceRuleTable)
+ .set({ webhookEnabled: false, updatedAt: new Date() })
+ .where(eq(userNotificationWorkspaceRuleTable.userId, userId));
+ }
+
+ return getNotificationPreferences(userId, emailAddress);
+}
+
+export async function upsertWorkspaceRule(
+ userId: string,
+ workspaceId: string,
+ emailAddress: string | null,
+ input: UpsertWorkspaceRuleInput,
+): Promise<NotificationPreferenceResponse> {
+ await assertWorkspaceMembership(userId, workspaceId);
+
+ if (input.projectMode === "selected") {
+ await validateProjectSelection(workspaceId, input.selectedProjectIds ?? []);
+ }
+
+ const preference = await db.query.userNotificationPreferenceTable.findFirst({
+ where: eq(userNotificationPreferenceTable.userId, userId),
+ });
+
+ if (input.emailEnabled && (!preference?.emailEnabled || !emailAddress)) {
+ throw new HTTPException(400, {
+ message: "Enable email notifications globally before using them here",
+ });
+ }
+
+ if (
+ input.ntfyEnabled &&
+ (!preference?.ntfyEnabled ||
+ !preference.ntfyServerUrl ||
+ !preference.ntfyTopic)
+ ) {
+ throw new HTTPException(400, {
+ message: "Enable ntfy notifications globally before using them here",
+ });
+ }
+
+ if (
+ input.webhookEnabled &&
+ (!preference?.webhookEnabled || !preference.webhookUrl)
+ ) {
+ throw new HTTPException(400, {
+ message: "Enable webhook notifications globally before using them here",
+ });
+ }
+
+ const existing = await db.query.userNotificationWorkspaceRuleTable.findFirst({
+ where: and(
+ eq(userNotificationWorkspaceRuleTable.userId, userId),
+ eq(userNotificationWorkspaceRuleTable.workspaceId, workspaceId),
+ ),
+ });
+
+ let ruleId = existing?.id;
+
+ if (existing) {
+ await db
+ .update(userNotificationWorkspaceRuleTable)
+ .set({
+ isActive: input.isActive,
+ emailEnabled: input.emailEnabled,
+ ntfyEnabled: input.ntfyEnabled,
+ webhookEnabled: input.webhookEnabled,
+ projectMode: input.projectMode,
+ updatedAt: new Date(),
+ })
+ .where(eq(userNotificationWorkspaceRuleTable.id, existing.id));
+ } else {
+ const [createdRule] = await db
+ .insert(userNotificationWorkspaceRuleTable)
+ .values({
+ userId,
+ workspaceId,
+ isActive: input.isActive,
+ emailEnabled: input.emailEnabled,
+ ntfyEnabled: input.ntfyEnabled,
+ webhookEnabled: input.webhookEnabled,
+ projectMode: input.projectMode,
+ })
+ .returning({ id: userNotificationWorkspaceRuleTable.id });
+ ruleId = createdRule?.id;
+ }
+
+ if (!ruleId) {
+ throw new HTTPException(500, {
+ message: "Failed to save notification workspace rule",
+ });
+ }
+
+ const workspaceRuleId = ruleId;
+
+ await db
+ .delete(userNotificationWorkspaceProjectTable)
+ .where(
+ eq(
+ userNotificationWorkspaceProjectTable.workspaceRuleId,
+ workspaceRuleId,
+ ),
+ );
+
+ if (input.projectMode === "selected") {
+ await db.insert(userNotificationWorkspaceProjectTable).values(
+ (input.selectedProjectIds ?? []).map((projectId) => ({
+ workspaceRuleId,
+ projectId,
+ })),
+ );
+ }
+
+ return getNotificationPreferences(userId, emailAddress);
+}
+
+export async function deleteWorkspaceRule(
+ userId: string,
+ workspaceId: string,
+ emailAddress: string | null,
+): Promise<NotificationPreferenceResponse> {
+ await assertWorkspaceMembership(userId, workspaceId);
+
+ const existing = await db.query.userNotificationWorkspaceRuleTable.findFirst({
+ where: and(
+ eq(userNotificationWorkspaceRuleTable.userId, userId),
+ eq(userNotificationWorkspaceRuleTable.workspaceId, workspaceId),
+ ),
+ });
+
+ if (!existing) {
+ throw new HTTPException(404, {
+ message: "Workspace notification rule not found",
+ });
+ }
+
+ await db
+ .delete(userNotificationWorkspaceRuleTable)
+ .where(eq(userNotificationWorkspaceRuleTable.id, existing.id));
+
+ return getNotificationPreferences(userId, emailAddress);
+}
+
+export async function listWorkspaceProjects(
+ workspaceId: string,
+ userId: string,
+) {
+ await assertWorkspaceMembership(userId, workspaceId);
+
+ return db
+ .select({
+ id: projectTable.id,
+ name: projectTable.name,
+ workspaceId: projectTable.workspaceId,
+ })
+ .from(projectTable)
+ .where(eq(projectTable.workspaceId, workspaceId));
+}
diff --git a/apps/api/src/notification/controllers/create-notification.ts b/apps/api/src/notification/controllers/create-notification.ts
index 525a0d890..a8de26cb0 100644
--- a/apps/api/src/notification/controllers/create-notification.ts
+++ b/apps/api/src/notification/controllers/create-notification.ts
@@ -2,6 +2,7 @@ import { createId } from "@paralleldrive/cuid2";
import db from "../../database";
import { notificationTable } from "../../database/schema";
import { publishEvent } from "../../events";
+import { deliverNotification } from "../../notification-preferences/delivery";
async function createNotification({
userId,
@@ -39,6 +40,12 @@ async function createNotification({
notificationId: notification.id,
userId,
});
+ void deliverNotification(notification.id).catch((error) => {
+ console.error("Failed to deliver notification", {
+ notificationId: notification.id,
+ error,
+ });
+ });
}
return notification;
diff --git a/apps/api/src/schemas.ts b/apps/api/src/schemas.ts
index 486404736..bf17a3004 100644
--- a/apps/api/src/schemas.ts
+++ b/apps/api/src/schemas.ts
@@ -98,6 +98,39 @@ export const notificationSchema = v.object({
createdAt: v.date(),
});
+export const notificationPreferenceWorkspaceRuleSchema = v.object({
+ id: v.string(),
+ workspaceId: v.string(),
+ workspaceName: v.string(),
+ isActive: v.boolean(),
+ emailEnabled: v.boolean(),
+ ntfyEnabled: v.boolean(),
+ webhookEnabled: v.boolean(),
+ projectMode: v.picklist(["all", "selected"] as const),
+ selectedProjectIds: v.array(v.string()),
+ createdAt: v.date(),
+ updatedAt: v.date(),
+});
+
+export const notificationPreferenceSchema = v.object({
+ emailAddress: v.nullable(v.string()),
+ emailEnabled: v.boolean(),
+ ntfyEnabled: v.boolean(),
+ ntfyConfigured: v.boolean(),
+ ntfyServerUrl: v.nullable(v.string()),
+ ntfyTopic: v.nullable(v.string()),
+ ntfyTokenConfigured: v.boolean(),
+ maskedNtfyToken: v.nullable(v.string()),
+ webhookEnabled: v.boolean(),
+ webhookConfigured: v.boolean(),
+ webhookUrl: v.nullable(v.string()),
+ webhookSecretConfigured: v.boolean(),
+ maskedWebhookSecret: v.nullable(v.string()),
+ workspaces: v.array(notificationPreferenceWorkspaceRuleSchema),
+ createdAt: v.nullable(v.date()),
+ updatedAt: v.nullable(v.date()),
+});
+
export const githubIntegrationSchema = v.object({
id: v.string(),
projectId: v.string(),
diff --git a/apps/web/src/components/account/notification-preferences-settings.tsx b/apps/web/src/components/account/notification-preferences-settings.tsx
new file mode 100644
index 000000000..276bdef79
--- /dev/null
+++ b/apps/web/src/components/account/notification-preferences-settings.tsx
@@ -0,0 +1,802 @@
+import { CheckCircle, Trash2 } from "lucide-react";
+import React from "react";
+import { useTranslation } from "react-i18next";
+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 { Radio, RadioGroup } from "@/components/ui/radio-group";
+import { Separator } from "@/components/ui/separator";
+import { Switch } from "@/components/ui/switch";
+import {
+ useDeleteNotificationWorkspaceRule,
+ useUpdateNotificationPreferences,
+ useUpsertNotificationWorkspaceRule,
+} from "@/hooks/mutations/notification-preferences/use-notification-preferences";
+import useGetNotificationPreferences from "@/hooks/queries/notification-preferences/use-get-notification-preferences";
+import useGetProjects from "@/hooks/queries/project/use-get-projects";
+import useGetWorkspaces from "@/hooks/queries/workspace/use-get-workspaces";
+import { toast } from "@/lib/toast";
+
+type WorkspaceSummary = {
+ id: string;
+ name: string;
+};
+
+type WorkspaceRuleState = {
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: "all" | "selected";
+ selectedProjectIds: string[];
+};
+
+function ChannelToggle({
+ checked,
+ disabled,
+ hint,
+ label,
+ onCheckedChange,
+}: {
+ checked: boolean;
+ disabled?: boolean;
+ hint?: string;
+ label: string;
+ onCheckedChange: (checked: boolean) => void;
+}) {
+ 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>
+ {hint ? <p className="text-xs text-muted-foreground">{hint}</p> : null}
+ </div>
+ <Switch
+ checked={checked}
+ disabled={disabled}
+ onCheckedChange={onCheckedChange}
+ />
+ </div>
+ );
+}
+
+function WorkspaceRuleCard({
+ hasEmailChannel,
+ hasNtfyChannel,
+ hasWebhookChannel,
+ onDelete,
+ onSave,
+ rule,
+ workspace,
+}: {
+ hasEmailChannel: boolean;
+ hasNtfyChannel: boolean;
+ hasWebhookChannel: boolean;
+ onDelete: (workspaceId: string) => Promise<unknown>;
+ onSave: (workspaceId: string, rule: WorkspaceRuleState) => Promise<void>;
+ rule?: {
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: "all" | "selected";
+ selectedProjectIds: string[];
+ };
+ workspace: WorkspaceSummary;
+}) {
+ const { t } = useTranslation();
+ const [state, setState] = React.useState<WorkspaceRuleState>({
+ isActive: rule?.isActive ?? false,
+ emailEnabled: rule?.emailEnabled ?? false,
+ ntfyEnabled: rule?.ntfyEnabled ?? false,
+ webhookEnabled: rule?.webhookEnabled ?? false,
+ projectMode: rule?.projectMode ?? "all",
+ selectedProjectIds: rule?.selectedProjectIds ?? [],
+ });
+ const [isSaving, setIsSaving] = React.useState(false);
+ const [isDeleting, setIsDeleting] = React.useState(false);
+ const { data: projects } = useGetProjects({
+ workspaceId:
+ state.projectMode === "selected" ||
+ (rule?.projectMode ?? "all") === "selected"
+ ? workspace.id
+ : "",
+ });
+
+ React.useEffect(() => {
+ setState({
+ isActive: rule?.isActive ?? false,
+ emailEnabled: rule?.emailEnabled ?? false,
+ ntfyEnabled: rule?.ntfyEnabled ?? false,
+ webhookEnabled: rule?.webhookEnabled ?? false,
+ projectMode: rule?.projectMode ?? "all",
+ selectedProjectIds: rule?.selectedProjectIds ?? [],
+ });
+ }, [rule]);
+
+ const isConnected = Boolean(rule);
+ const isBusy = isSaving || isDeleting;
+
+ const toggleProject = (projectId: string, checked: boolean) => {
+ setState((current) => ({
+ ...current,
+ selectedProjectIds: checked
+ ? [...current.selectedProjectIds, projectId]
+ : current.selectedProjectIds.filter((id) => id !== projectId),
+ }));
+ };
+
+ return (
+ <div className="space-y-4 border border-border rounded-md bg-sidebar p-4">
+ <div className="flex items-start justify-between gap-4">
+ <div className="min-w-0 space-y-1">
+ <p className="text-sm font-medium">{workspace.name}</p>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.workspaceCardHint")}
+ </p>
+ </div>
+
+ <div className="flex shrink-0 items-center gap-3">
+ {isConnected ? (
+ <div className="flex items-center gap-2 text-xs text-muted-foreground">
+ <CheckCircle className="size-4 text-green-600" />
+ <span>
+ {state.isActive
+ ? t("settings:notificationsPage.statusConnected")
+ : t("settings:notificationsPage.statusPaused")}
+ </span>
+ </div>
+ ) : null}
+ <Switch
+ checked={state.isActive}
+ disabled={isBusy}
+ onCheckedChange={(checked) =>
+ setState((current) => ({ ...current, isActive: checked }))
+ }
+ />
+ </div>
+ </div>
+
+ <Separator />
+
+ <div className="space-y-3">
+ <ChannelToggle
+ checked={state.emailEnabled}
+ disabled={!hasEmailChannel || isBusy}
+ hint={
+ hasEmailChannel
+ ? t("settings:notificationsPage.emailChannelHintEnabled")
+ : t("settings:notificationsPage.emailChannelHintDisabled")
+ }
+ label={t("settings:notificationsPage.workspaceCardLabelEmail")}
+ onCheckedChange={(checked) =>
+ setState((current) => ({ ...current, emailEnabled: checked }))
+ }
+ />
+ <ChannelToggle
+ checked={state.ntfyEnabled}
+ disabled={!hasNtfyChannel || isBusy}
+ hint={
+ hasNtfyChannel
+ ? t("settings:notificationsPage.ntfyChannelHintEnabled")
+ : t("settings:notificationsPage.ntfyChannelHintDisabled")
+ }
+ label={t("settings:notificationsPage.workspaceCardLabelNtfy")}
+ onCheckedChange={(checked) =>
+ setState((current) => ({ ...current, ntfyEnabled: checked }))
+ }
+ />
+ <ChannelToggle
+ checked={state.webhookEnabled}
+ disabled={!hasWebhookChannel || isBusy}
+ hint={
+ hasWebhookChannel
+ ? t("settings:notificationsPage.webhookChannelHintEnabled")
+ : t("settings:notificationsPage.webhookChannelHintDisabled")
+ }
+ label={t("settings:notificationsPage.workspaceCardLabelWebhook")}
+ onCheckedChange={(checked) =>
+ setState((current) => ({ ...current, webhookEnabled: checked }))
+ }
+ />
+ </div>
+
+ <Separator />
+
+ <div className="space-y-3">
+ <div className="space-y-0.5">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.projectScope")}
+ </Label>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.projectScopeDescription")}
+ </p>
+ </div>
+
+ <RadioGroup
+ className="gap-2"
+ value={state.projectMode}
+ onValueChange={(value) =>
+ setState((current) => ({
+ ...current,
+ projectMode: value === "selected" ? "selected" : "all",
+ }))
+ }
+ >
+ <label
+ className="flex items-start gap-3"
+ htmlFor={`${workspace.id}-project-scope-all`}
+ >
+ <Radio
+ className="mt-0.5"
+ id={`${workspace.id}-project-scope-all`}
+ value="all"
+ />
+ <div className="min-w-0 space-y-0.5">
+ <p className="text-sm font-medium">
+ {t("settings:notificationsPage.allProjects")}
+ </p>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.allProjectsDescription")}
+ </p>
+ </div>
+ </label>
+
+ <label
+ className="flex items-start gap-3"
+ htmlFor={`${workspace.id}-project-scope-selected`}
+ >
+ <Radio
+ className="mt-0.5"
+ id={`${workspace.id}-project-scope-selected`}
+ value="selected"
+ />
+ <div className="min-w-0 space-y-0.5">
+ <p className="text-sm font-medium">
+ {t("settings:notificationsPage.selectedProjects")}
+ </p>
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.selectedProjectsDescription")}
+ </p>
+ </div>
+ </label>
+ </RadioGroup>
+
+ {state.projectMode === "selected" ? (
+ <div className="space-y-2 border border-dashed border-border/80 rounded-md px-3 py-3">
+ {!projects?.length ? (
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.noProjectsInWorkspace")}
+ </p>
+ ) : (
+ projects.map((project) => {
+ const checked = state.selectedProjectIds.includes(project.id);
+
+ return (
+ <label
+ key={project.id}
+ className="flex items-center gap-3"
+ htmlFor={`${workspace.id}-project-${project.id}`}
+ >
+ <Checkbox
+ checked={checked}
+ id={`${workspace.id}-project-${project.id}`}
+ onCheckedChange={(value) =>
+ toggleProject(project.id, Boolean(value))
+ }
+ />
+ <span className="text-sm font-medium">{project.name}</span>
+ </label>
+ );
+ })
+ )}
+ </div>
+ ) : null}
+ </div>
+
+ <Separator />
+
+ <div className="flex flex-wrap gap-2">
+ <Button
+ disabled={isBusy}
+ onClick={async () => {
+ try {
+ setIsSaving(true);
+ await onSave(workspace.id, state);
+ toast.success(
+ t("settings:notificationsPage.toastRuleSaved", {
+ workspaceName: workspace.name,
+ }),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:notificationsPage.toastRuleSaveFailed"),
+ );
+ } finally {
+ setIsSaving(false);
+ }
+ }}
+ type="button"
+ >
+ {isConnected
+ ? t("settings:notificationsPage.saveChanges")
+ : t("settings:notificationsPage.createRule")}
+ </Button>
+ {isConnected ? (
+ <Button
+ disabled={isBusy}
+ onClick={async () => {
+ try {
+ setIsDeleting(true);
+ await onDelete(workspace.id);
+ toast.success(
+ t("settings:notificationsPage.toastRuleRemoved", {
+ workspaceName: workspace.name,
+ }),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:notificationsPage.toastRuleRemoveFailed"),
+ );
+ } finally {
+ setIsDeleting(false);
+ }
+ }}
+ type="button"
+ variant="outline"
+ >
+ <Trash2 className="size-4" />
+ {t("settings:notificationsPage.removeRule")}
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ );
+}
+
+export function NotificationPreferencesSettings() {
+ const { t } = useTranslation();
+ const { data: preferences, isLoading } = useGetNotificationPreferences();
+ const { data: workspacesData } = useGetWorkspaces();
+ const { mutateAsync: updatePreferences, isPending: isSavingPreferences } =
+ useUpdateNotificationPreferences();
+ const { mutateAsync: upsertWorkspaceRule } =
+ useUpsertNotificationWorkspaceRule();
+ const { mutateAsync: deleteWorkspaceRule } =
+ useDeleteNotificationWorkspaceRule();
+
+ const workspaces = React.useMemo(
+ () =>
+ ((workspacesData ?? []) as WorkspaceSummary[]).map((workspace) => ({
+ id: workspace.id,
+ name: workspace.name,
+ })),
+ [workspacesData],
+ );
+
+ const [emailEnabled, setEmailEnabled] = React.useState(false);
+ const [ntfyEnabled, setNtfyEnabled] = React.useState(false);
+ const [ntfyServerUrl, setNtfyServerUrl] = React.useState("");
+ const [ntfyTopic, setNtfyTopic] = React.useState("");
+ const [ntfyToken, setNtfyToken] = React.useState("");
+ const [webhookEnabled, setWebhookEnabled] = React.useState(false);
+ const [webhookUrl, setWebhookUrl] = React.useState("");
+ const [webhookSecret, setWebhookSecret] = React.useState("");
+
+ React.useEffect(() => {
+ if (!preferences) return;
+ setEmailEnabled(preferences.emailEnabled);
+ setNtfyEnabled(preferences.ntfyEnabled);
+ setNtfyServerUrl(preferences.ntfyServerUrl ?? "");
+ setNtfyTopic(preferences.ntfyTopic ?? "");
+ setNtfyToken("");
+ setWebhookEnabled(preferences.webhookEnabled);
+ setWebhookUrl(preferences.webhookUrl ?? "");
+ setWebhookSecret("");
+ }, [preferences]);
+
+ const workspaceRuleMap = React.useMemo(
+ () =>
+ new Map(
+ (preferences?.workspaces ?? []).map((workspaceRule) => [
+ workspaceRule.workspaceId,
+ workspaceRule,
+ ]),
+ ),
+ [preferences?.workspaces],
+ );
+
+ if (isLoading) {
+ return (
+ <div className="space-y-4">
+ <div className="h-24 animate-pulse rounded-md bg-muted" />
+ <div className="h-24 animate-pulse rounded-md bg-muted" />
+ <div className="h-48 animate-pulse rounded-md bg-muted" />
+ </div>
+ );
+ }
+
+ return (
+ <div className="space-y-8">
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <h3 className="font-medium">
+ {t("settings:notificationsPage.emailTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.emailDescription")}
+ </p>
+ </div>
+ <div className="flex items-center gap-3">
+ {preferences?.emailEnabled ? (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <CheckCircle className="size-4 text-green-600" />
+ <span>{t("settings:notificationsPage.statusConnected")}</span>
+ </div>
+ ) : null}
+ <Switch
+ checked={emailEnabled}
+ disabled={isSavingPreferences || !preferences?.emailAddress}
+ onCheckedChange={setEmailEnabled}
+ />
+ </div>
+ </div>
+
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.accountEmailLabel")}
+ </Label>
+ <Input
+ disabled
+ readOnly
+ value={
+ preferences?.emailAddress ??
+ t("settings:notificationsPage.accountEmailNoAddress")
+ }
+ />
+ <p className="text-xs text-muted-foreground">
+ {t("settings:notificationsPage.accountEmailHint")}
+ </p>
+ </div>
+
+ <div className="flex gap-2">
+ <Button
+ disabled={isSavingPreferences || !preferences?.emailAddress}
+ onClick={async () => {
+ try {
+ await updatePreferences({ emailEnabled });
+ toast.success(t("settings:notificationsPage.toastEmailSaved"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:notificationsPage.toastEmailSaveFailed"),
+ );
+ }
+ }}
+ type="button"
+ >
+ {t("settings:notificationsPage.saveChanges")}
+ </Button>
+ </div>
+ </div>
+
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <h3 className="font-medium">
+ {t("settings:notificationsPage.ntfyTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.ntfyDescription")}
+ </p>
+ </div>
+ <div className="flex items-center gap-3">
+ {preferences?.ntfyConfigured ? (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <CheckCircle className="size-4 text-green-600" />
+ <span>
+ {preferences.ntfyEnabled
+ ? t("settings:notificationsPage.statusConnected")
+ : t("settings:notificationsPage.statusPaused")}
+ </span>
+ </div>
+ ) : null}
+ <Switch
+ checked={ntfyEnabled}
+ disabled={isSavingPreferences}
+ onCheckedChange={setNtfyEnabled}
+ />
+ </div>
+ </div>
+
+ <div className="space-y-4">
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.serverUrl")}
+ </Label>
+ <Input
+ autoComplete="off"
+ placeholder={t(
+ "settings:notificationsPage.ntfyServerPlaceholder",
+ )}
+ value={ntfyServerUrl}
+ onChange={(event) => setNtfyServerUrl(event.target.value)}
+ />
+ </div>
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.topic")}
+ </Label>
+ <Input
+ autoComplete="off"
+ placeholder={t("settings:notificationsPage.ntfyTopicPlaceholder")}
+ value={ntfyTopic}
+ onChange={(event) => setNtfyTopic(event.target.value)}
+ />
+ </div>
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.token")}
+ </Label>
+ <Input
+ autoComplete="off"
+ placeholder={t("settings:notificationsPage.ntfyTokenPlaceholder")}
+ type="password"
+ value={ntfyToken}
+ onChange={(event) => setNtfyToken(event.target.value)}
+ />
+ <p className="text-xs text-muted-foreground">
+ {preferences?.ntfyTokenConfigured
+ ? t("settings:notificationsPage.ntfyTokenHintConfigured", {
+ masked: preferences.maskedNtfyToken ?? "••••",
+ })
+ : t("settings:notificationsPage.ntfyTokenHintOptional")}
+ </p>
+ </div>
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <Button
+ disabled={isSavingPreferences}
+ onClick={async () => {
+ try {
+ await updatePreferences({
+ ntfyEnabled,
+ ntfyServerUrl,
+ ntfyTopic,
+ ntfyToken: ntfyToken.trim() ? ntfyToken : undefined,
+ });
+ setNtfyToken("");
+ toast.success(t("settings:notificationsPage.toastNtfySaved"));
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:notificationsPage.toastNtfySaveFailed"),
+ );
+ }
+ }}
+ type="button"
+ >
+ {preferences?.ntfyConfigured
+ ? t("settings:notificationsPage.saveChanges")
+ : t("settings:notificationsPage.connectNtfy")}
+ </Button>
+ {preferences?.ntfyConfigured ? (
+ <Button
+ disabled={isSavingPreferences}
+ onClick={async () => {
+ try {
+ await updatePreferences({
+ ntfyEnabled: false,
+ ntfyServerUrl: null,
+ ntfyTopic: null,
+ ntfyToken: null,
+ });
+ setNtfyEnabled(false);
+ setNtfyServerUrl("");
+ setNtfyTopic("");
+ setNtfyToken("");
+ toast.success(
+ t("settings:notificationsPage.toastNtfyDisconnected"),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t(
+ "settings:notificationsPage.toastNtfyDisconnectFailed",
+ ),
+ );
+ }
+ }}
+ type="button"
+ variant="outline"
+ >
+ <Trash2 className="size-4" />
+ {t("settings:notificationsPage.disconnect")}
+ </Button>
+ ) : null}
+ </div>
+ </div>
+
+ <div className="space-y-4 rounded-md border border-border bg-sidebar p-4">
+ <div className="flex items-start justify-between gap-4">
+ <div className="space-y-1">
+ <h3 className="font-medium">
+ {t("settings:notificationsPage.webhookTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.webhookDescription")}
+ </p>
+ </div>
+ <div className="flex items-center gap-3">
+ {preferences?.webhookConfigured ? (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <CheckCircle className="size-4 text-green-600" />
+ <span>
+ {preferences.webhookEnabled
+ ? t("settings:notificationsPage.statusConnected")
+ : t("settings:notificationsPage.statusPaused")}
+ </span>
+ </div>
+ ) : null}
+ <Switch
+ checked={webhookEnabled}
+ disabled={isSavingPreferences}
+ onCheckedChange={setWebhookEnabled}
+ />
+ </div>
+ </div>
+
+ <div className="space-y-4">
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.endpointUrl")}
+ </Label>
+ <Input
+ autoComplete="off"
+ placeholder={t(
+ "settings:notificationsPage.webhookUrlPlaceholder",
+ )}
+ type="url"
+ value={webhookUrl}
+ onChange={(event) => setWebhookUrl(event.target.value)}
+ />
+ </div>
+ <div className="space-y-1">
+ <Label className="text-sm font-medium">
+ {t("settings:notificationsPage.signingSecret")}
+ </Label>
+ <Input
+ autoComplete="off"
+ placeholder={t(
+ "settings:notificationsPage.webhookSecretPlaceholder",
+ )}
+ type="password"
+ value={webhookSecret}
+ onChange={(event) => setWebhookSecret(event.target.value)}
+ />
+ <p className="text-xs text-muted-foreground">
+ {preferences?.webhookSecretConfigured
+ ? t("settings:notificationsPage.webhookSecretHintConfigured", {
+ masked: preferences.maskedWebhookSecret ?? "••••",
+ })
+ : t("settings:notificationsPage.webhookSecretHintOptional")}
+ </p>
+ </div>
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <Button
+ disabled={isSavingPreferences}
+ onClick={async () => {
+ try {
+ await updatePreferences({
+ webhookEnabled,
+ webhookUrl,
+ webhookSecret: webhookSecret.trim()
+ ? webhookSecret
+ : undefined,
+ });
+ setWebhookSecret("");
+ toast.success(
+ t("settings:notificationsPage.toastWebhookSaved"),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t("settings:notificationsPage.toastWebhookSaveFailed"),
+ );
+ }
+ }}
+ type="button"
+ >
+ {preferences?.webhookConfigured
+ ? t("settings:notificationsPage.saveChanges")
+ : t("settings:notificationsPage.connectWebhook")}
+ </Button>
+ {preferences?.webhookConfigured ? (
+ <Button
+ disabled={isSavingPreferences}
+ onClick={async () => {
+ try {
+ await updatePreferences({
+ webhookEnabled: false,
+ webhookUrl: null,
+ webhookSecret: null,
+ });
+ setWebhookEnabled(false);
+ setWebhookUrl("");
+ setWebhookSecret("");
+ toast.success(
+ t("settings:notificationsPage.toastWebhookDisconnected"),
+ );
+ } catch (error) {
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t(
+ "settings:notificationsPage.toastWebhookDisconnectFailed",
+ ),
+ );
+ }
+ }}
+ type="button"
+ variant="outline"
+ >
+ <Trash2 className="size-4" />
+ {t("settings:notificationsPage.disconnect")}
+ </Button>
+ ) : null}
+ </div>
+ </div>
+
+ <div className="space-y-4">
+ <div className="space-y-1">
+ <h3 className="font-medium">
+ {t("settings:notificationsPage.workspaceRulesTitle")}
+ </h3>
+ <p className="text-sm text-muted-foreground">
+ {t("settings:notificationsPage.workspaceRulesDescription")}
+ </p>
+ </div>
+
+ <div className="space-y-4">
+ {workspaces.map((workspace) => {
+ const rule = workspaceRuleMap.get(workspace.id);
+
+ return (
+ <WorkspaceRuleCard
+ key={workspace.id}
+ hasEmailChannel={Boolean(preferences?.emailEnabled)}
+ hasNtfyChannel={Boolean(
+ preferences?.ntfyEnabled && preferences?.ntfyConfigured,
+ )}
+ hasWebhookChannel={Boolean(
+ preferences?.webhookEnabled && preferences?.webhookConfigured,
+ )}
+ onDelete={deleteWorkspaceRule}
+ onSave={async (workspaceId, nextRule) => {
+ await upsertWorkspaceRule({
+ workspaceId,
+ json: nextRule,
+ });
+ }}
+ rule={rule}
+ workspace={workspace}
+ />
+ );
+ })}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts b/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts
new file mode 100644
index 000000000..b3f3defba
--- /dev/null
+++ b/apps/web/src/fetchers/notification-preferences/delete-notification-workspace-rule.ts
@@ -0,0 +1,23 @@
+import { getApiUrl } from "@/fetchers/get-api-url";
+import type { NotificationPreferences } from "./get-notification-preferences";
+
+async function deleteNotificationWorkspaceRule(
+ workspaceId: string,
+): Promise<NotificationPreferences> {
+ const response = await fetch(
+ getApiUrl(`/notification-preferences/workspaces/${workspaceId}`),
+ {
+ credentials: "include",
+ method: "DELETE",
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as NotificationPreferences;
+}
+
+export default deleteNotificationWorkspaceRule;
diff --git a/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
new file mode 100644
index 000000000..ecd108a7a
--- /dev/null
+++ b/apps/web/src/fetchers/notification-preferences/get-notification-preferences.ts
@@ -0,0 +1,49 @@
+import { getApiUrl } from "@/fetchers/get-api-url";
+
+export type NotificationPreferenceWorkspaceRule = {
+ id: string;
+ workspaceId: string;
+ workspaceName: string;
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: "all" | "selected";
+ selectedProjectIds: string[];
+ createdAt: string;
+ updatedAt: string;
+};
+
+export type NotificationPreferences = {
+ emailAddress: string | null;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ ntfyConfigured: boolean;
+ ntfyServerUrl: string | null;
+ ntfyTopic: string | null;
+ ntfyTokenConfigured: boolean;
+ maskedNtfyToken: string | null;
+ webhookEnabled: boolean;
+ webhookConfigured: boolean;
+ webhookUrl: string | null;
+ webhookSecretConfigured: boolean;
+ maskedWebhookSecret: string | null;
+ workspaces: NotificationPreferenceWorkspaceRule[];
+ createdAt: string | null;
+ updatedAt: string | null;
+};
+
+async function getNotificationPreferences(): Promise<NotificationPreferences> {
+ const response = await fetch(getApiUrl("/notification-preferences"), {
+ credentials: "include",
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as NotificationPreferences;
+}
+
+export default getNotificationPreferences;
diff --git a/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
new file mode 100644
index 000000000..149d812fc
--- /dev/null
+++ b/apps/web/src/fetchers/notification-preferences/update-notification-preferences.ts
@@ -0,0 +1,35 @@
+import { getApiUrl } from "@/fetchers/get-api-url";
+import type { NotificationPreferences } from "./get-notification-preferences";
+
+export type UpdateNotificationPreferencesRequest = {
+ emailEnabled?: boolean;
+ ntfyEnabled?: boolean;
+ ntfyServerUrl?: string | null;
+ ntfyTopic?: string | null;
+ ntfyToken?: string | null;
+ webhookEnabled?: boolean;
+ webhookUrl?: string | null;
+ webhookSecret?: string | null;
+};
+
+async function updateNotificationPreferences(
+ json: UpdateNotificationPreferencesRequest,
+): Promise<NotificationPreferences> {
+ const response = await fetch(getApiUrl("/notification-preferences"), {
+ body: JSON.stringify(json),
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ method: "PUT",
+ });
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as NotificationPreferences;
+}
+
+export default updateNotificationPreferences;
diff --git a/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts b/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts
new file mode 100644
index 000000000..8508dc3e4
--- /dev/null
+++ b/apps/web/src/fetchers/notification-preferences/upsert-notification-workspace-rule.ts
@@ -0,0 +1,37 @@
+import { getApiUrl } from "@/fetchers/get-api-url";
+import type { NotificationPreferences } from "./get-notification-preferences";
+
+export type UpsertNotificationWorkspaceRuleRequest = {
+ isActive: boolean;
+ emailEnabled: boolean;
+ ntfyEnabled: boolean;
+ webhookEnabled: boolean;
+ projectMode: "all" | "selected";
+ selectedProjectIds?: string[];
+};
+
+async function upsertNotificationWorkspaceRule(
+ workspaceId: string,
+ json: UpsertNotificationWorkspaceRuleRequest,
+): Promise<NotificationPreferences> {
+ const response = await fetch(
+ getApiUrl(`/notification-preferences/workspaces/${workspaceId}`),
+ {
+ body: JSON.stringify(json),
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ method: "PUT",
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error);
+ }
+
+ return (await response.json()) as NotificationPreferences;
+}
+
+export default upsertNotificationWorkspaceRule;
diff --git a/apps/web/src/hooks/mutations/notification-preferences/use-notification-preferences.ts b/apps/web/src/hooks/mutations/notification-preferences/use-notification-preferences.ts
new file mode 100644
index 000000000..d5e5a57c0
--- /dev/null
+++ b/apps/web/src/hooks/mutations/notification-preferences/use-notification-preferences.ts
@@ -0,0 +1,55 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import deleteNotificationWorkspaceRule from "@/fetchers/notification-preferences/delete-notification-workspace-rule";
+import updateNotificationPreferences, {
+ type UpdateNotificationPreferencesRequest,
+} from "@/fetchers/notification-preferences/update-notification-preferences";
+import upsertNotificationWorkspaceRule, {
+ type UpsertNotificationWorkspaceRuleRequest,
+} from "@/fetchers/notification-preferences/upsert-notification-workspace-rule";
+
+export function useUpdateNotificationPreferences() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: (json: UpdateNotificationPreferencesRequest) =>
+ updateNotificationPreferences(json),
+ onSuccess: () => {
+ void queryClient.invalidateQueries({
+ queryKey: ["notification-preferences"],
+ });
+ },
+ });
+}
+
+export function useUpsertNotificationWorkspaceRule() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: ({
+ workspaceId,
+ json,
+ }: {
+ workspaceId: string;
+ json: UpsertNotificationWorkspaceRuleRequest;
+ }) => upsertNotificationWorkspaceRule(workspaceId, json),
+ onSuccess: () => {
+ void queryClient.invalidateQueries({
+ queryKey: ["notification-preferences"],
+ });
+ },
+ });
+}
+
+export function useDeleteNotificationWorkspaceRule() {
+ const queryClient = useQueryClient();
+
+ return useMutation({
+ mutationFn: (workspaceId: string) =>
+ deleteNotificationWorkspaceRule(workspaceId),
+ onSuccess: () => {
+ void queryClient.invalidateQueries({
+ queryKey: ["notification-preferences"],
+ });
+ },
+ });
+}
diff --git a/apps/web/src/hooks/queries/notification-preferences/use-get-notification-preferences.ts b/apps/web/src/hooks/queries/notification-preferences/use-get-notification-preferences.ts
new file mode 100644
index 000000000..d5a5ea30a
--- /dev/null
+++ b/apps/web/src/hooks/queries/notification-preferences/use-get-notification-preferences.ts
@@ -0,0 +1,11 @@
+import { useQuery } from "@tanstack/react-query";
+import getNotificationPreferences from "@/fetchers/notification-preferences/get-notification-preferences";
+
+function useGetNotificationPreferences() {
+ return useQuery({
+ queryFn: getNotificationPreferences,
+ queryKey: ["notification-preferences"],
+ });
+}
+
+export default useGetNotificationPreferences;
diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts
index 6b17e1dc3..accb69077 100644
--- a/apps/web/src/routeTree.gen.ts
+++ b/apps/web/src/routeTree.gen.ts
@@ -37,6 +37,7 @@ import { Route as LayoutAuthenticatedDashboardWorkspaceWorkspaceIdSearchRouteImp
import { Route as LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRouteImport } from './routes/_layout/_authenticated/dashboard/workspace/$workspaceId/members'
import { Route as LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRouteImport } from './routes/_layout/_authenticated/dashboard/settings/workspace/general'
import { Route as LayoutAuthenticatedDashboardSettingsAccountPreferencesRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/preferences'
+import { Route as LayoutAuthenticatedDashboardSettingsAccountNotificationsRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/notifications'
import { Route as LayoutAuthenticatedDashboardSettingsAccountInformationRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/information'
import { Route as LayoutAuthenticatedDashboardSettingsAccountDeveloperRouteImport } from './routes/_layout/_authenticated/dashboard/settings/account/developer'
import { Route as LayoutAuthenticatedDashboardSettingsProjectsProjectIdWorkflowRouteImport } from './routes/_layout/_authenticated/dashboard/settings/projects/$projectId/workflow'
@@ -205,6 +206,12 @@ const LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute =
path: '/preferences',
getParentRoute: () => LayoutAuthenticatedDashboardSettingsAccountRoute,
} as any)
+const LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute =
+ LayoutAuthenticatedDashboardSettingsAccountNotificationsRouteImport.update({
+ id: '/notifications',
+ path: '/notifications',
+ getParentRoute: () => LayoutAuthenticatedDashboardSettingsAccountRoute,
+ } as any)
const LayoutAuthenticatedDashboardSettingsAccountInformationRoute =
LayoutAuthenticatedDashboardSettingsAccountInformationRouteImport.update({
id: '/information',
@@ -319,6 +326,7 @@ export interface FileRoutesByFullPath {
'/dashboard/workspace/create': typeof LayoutAuthenticatedDashboardWorkspaceCreateRoute
'/dashboard/settings/account/developer': typeof LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute
'/dashboard/settings/account/information': typeof LayoutAuthenticatedDashboardSettingsAccountInformationRoute
+ '/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
'/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
@@ -356,6 +364,7 @@ export interface FileRoutesByTo {
'/dashboard/workspace/create': typeof LayoutAuthenticatedDashboardWorkspaceCreateRoute
'/dashboard/settings/account/developer': typeof LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute
'/dashboard/settings/account/information': typeof LayoutAuthenticatedDashboardSettingsAccountInformationRoute
+ '/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
'/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
@@ -398,6 +407,7 @@ export interface FileRoutesById {
'/_layout/_authenticated/dashboard/workspace/create': typeof LayoutAuthenticatedDashboardWorkspaceCreateRoute
'/_layout/_authenticated/dashboard/settings/account/developer': typeof LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute
'/_layout/_authenticated/dashboard/settings/account/information': typeof LayoutAuthenticatedDashboardSettingsAccountInformationRoute
+ '/_layout/_authenticated/dashboard/settings/account/notifications': typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
'/_layout/_authenticated/dashboard/settings/account/preferences': typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
'/_layout/_authenticated/dashboard/settings/workspace/general': typeof LayoutAuthenticatedDashboardSettingsWorkspaceGeneralRoute
'/_layout/_authenticated/dashboard/workspace/$workspaceId/members': typeof LayoutAuthenticatedDashboardWorkspaceWorkspaceIdMembersRoute
@@ -439,6 +449,7 @@ export interface FileRouteTypes {
| '/dashboard/workspace/create'
| '/dashboard/settings/account/developer'
| '/dashboard/settings/account/information'
+ | '/dashboard/settings/account/notifications'
| '/dashboard/settings/account/preferences'
| '/dashboard/settings/workspace/general'
| '/dashboard/workspace/$workspaceId/members'
@@ -476,6 +487,7 @@ export interface FileRouteTypes {
| '/dashboard/workspace/create'
| '/dashboard/settings/account/developer'
| '/dashboard/settings/account/information'
+ | '/dashboard/settings/account/notifications'
| '/dashboard/settings/account/preferences'
| '/dashboard/settings/workspace/general'
| '/dashboard/workspace/$workspaceId/members'
@@ -517,6 +529,7 @@ export interface FileRouteTypes {
| '/_layout/_authenticated/dashboard/workspace/create'
| '/_layout/_authenticated/dashboard/settings/account/developer'
| '/_layout/_authenticated/dashboard/settings/account/information'
+ | '/_layout/_authenticated/dashboard/settings/account/notifications'
| '/_layout/_authenticated/dashboard/settings/account/preferences'
| '/_layout/_authenticated/dashboard/settings/workspace/general'
| '/_layout/_authenticated/dashboard/workspace/$workspaceId/members'
@@ -740,6 +753,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRouteImport
parentRoute: typeof LayoutAuthenticatedDashboardSettingsAccountRoute
}
+ '/_layout/_authenticated/dashboard/settings/account/notifications': {
+ id: '/_layout/_authenticated/dashboard/settings/account/notifications'
+ path: '/notifications'
+ fullPath: '/dashboard/settings/account/notifications'
+ preLoaderRoute: typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRouteImport
+ parentRoute: typeof LayoutAuthenticatedDashboardSettingsAccountRoute
+ }
'/_layout/_authenticated/dashboard/settings/account/information': {
id: '/_layout/_authenticated/dashboard/settings/account/information'
path: '/information'
@@ -823,6 +843,7 @@ declare module '@tanstack/react-router' {
interface LayoutAuthenticatedDashboardSettingsAccountRouteChildren {
LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute: typeof LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute
LayoutAuthenticatedDashboardSettingsAccountInformationRoute: typeof LayoutAuthenticatedDashboardSettingsAccountInformationRoute
+ LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute: typeof LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute
LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute: typeof LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute
}
@@ -832,6 +853,8 @@ const LayoutAuthenticatedDashboardSettingsAccountRouteChildren: LayoutAuthentica
LayoutAuthenticatedDashboardSettingsAccountDeveloperRoute,
LayoutAuthenticatedDashboardSettingsAccountInformationRoute:
LayoutAuthenticatedDashboardSettingsAccountInformationRoute,
+ LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute:
+ LayoutAuthenticatedDashboardSettingsAccountNotificationsRoute,
LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute:
LayoutAuthenticatedDashboardSettingsAccountPreferencesRoute,
}
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx
index 594a16cf7..c6a390916 100644
--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx
@@ -4,7 +4,7 @@ import {
Outlet,
useLocation,
} from "@tanstack/react-router";
-import { Code, Settings, User } from "lucide-react";
+import { Bell, Code, Settings, User } from "lucide-react";
import { useTranslation } from "react-i18next";
import useAuth from "@/components/providers/auth-provider/hooks/use-auth";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
@@ -35,6 +35,11 @@ function RouteComponent() {
url: "/dashboard/settings/account/information",
icon: User,
},
+ {
+ title: t("settings:notifications"),
+ url: "/dashboard/settings/account/notifications",
+ icon: Bell,
+ },
{
title: t("settings:preferences"),
url: "/dashboard/settings/account/preferences",
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/notifications.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/notifications.tsx
new file mode 100644
index 000000000..de23fe3c2
--- /dev/null
+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/notifications.tsx
@@ -0,0 +1,32 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { useTranslation } from "react-i18next";
+import { NotificationPreferencesSettings } from "@/components/account/notification-preferences-settings";
+import PageTitle from "@/components/page-title";
+
+export const Route = createFileRoute(
+ "/_layout/_authenticated/dashboard/settings/account/notifications",
+)({
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ const { t } = useTranslation();
+
+ return (
+ <>
+ <PageTitle title={t("settings:notificationsPage.pageTitle")} />
+ <div className="max-w-4xl mx-auto space-y-8">
+ <div className="space-y-2">
+ <h1 className="text-2xl font-semibold">
+ {t("settings:notificationsPage.title")}
+ </h1>
+ <p className="text-muted-foreground">
+ {t("settings:notificationsPage.subtitle")}
+ </p>
+ </div>
+
+ <NotificationPreferencesSettings />
+ </div>
+ </>
+ );
+}
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index a4ae060dc..3bbd6b268 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -298,6 +298,7 @@
"account": "Konto",
"developer": "Entwicklung",
"information": "Informationen",
+ "notifications": "Benachrichtigungen",
"preferences": "Einstellungen",
"apiKeys": "API-Schlüssel",
"informationPage": {
@@ -319,6 +320,75 @@
"invalidEmail": "Ungültige E-Mail-Adresse"
}
},
+ "notificationsPage": {
+ "pageTitle": "Benachrichtigungen",
+ "title": "Benachrichtigungen",
+ "subtitle": "Lege fest, wie Kaneo deine Kontobenachrichtigungen zustellt und welche Kanäle du nutzt.",
+ "statusConnected": "Verbunden",
+ "statusPaused": "Pausiert",
+ "emailTitle": "E-Mail",
+ "emailDescription": "Nutze deine Konten-E-Mail als Ziel für Benachrichtigungen.",
+ "accountEmailLabel": "Konten-E-Mail",
+ "accountEmailNoAddress": "Keine Konten-E-Mail vorhanden",
+ "accountEmailHint": "E-Mail-Zustellung erfolgt immer an die E-Mail des angemeldeten Kontos.",
+ "saveChanges": "Änderungen speichern",
+ "disconnect": "Trennen",
+ "ntfyTitle": "ntfy",
+ "ntfyDescription": "Kontobenachrichtigungen an ein ntfy-Thema senden.",
+ "serverUrl": "Server-URL",
+ "topic": "Thema",
+ "token": "Token",
+ "ntfyServerPlaceholder": "https://ntfy.example.com",
+ "ntfyTopicPlaceholder": "team-alerts",
+ "ntfyTokenPlaceholder": "Optionaler Bearer-Token",
+ "ntfyTokenHintConfigured": "Ein Token ist bereits konfiguriert ({{masked}}). Gib einen neuen Token ein, um ihn zu ersetzen.",
+ "ntfyTokenHintOptional": "Optional. Gib einen Token an, wenn dein ntfy-Server eine Authentifizierung verlangt.",
+ "connectNtfy": "ntfy verbinden",
+ "webhookTitle": "Benutzerdefinierter Webhook",
+ "webhookDescription": "Kontobenachrichtigungen als JSON an deinen eigenen Endpunkt senden.",
+ "endpointUrl": "Endpunkt-URL",
+ "signingSecret": "Signatur-Geheimnis",
+ "webhookUrlPlaceholder": "https://example.com/webhooks/kaneo",
+ "webhookSecretPlaceholder": "Optionales gemeinsames Geheimnis",
+ "webhookSecretHintConfigured": "Ein Signatur-Geheimnis ist bereits konfiguriert ({{masked}}). Gib ein neues ein, um es zu ersetzen.",
+ "webhookSecretHintOptional": "Optional. Kaneo signiert den Anfragetext, wenn ein Geheimnis gesetzt ist.",
+ "connectWebhook": "Webhook verbinden",
+ "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.",
+ "workspaceCardLabelEmail": "E-Mail",
+ "workspaceCardLabelNtfy": "ntfy",
+ "workspaceCardLabelWebhook": "Benutzerdefinierter Webhook",
+ "emailChannelHintEnabled": "Passende Arbeitsbereichs-Benachrichtigungen per E-Mail senden.",
+ "emailChannelHintDisabled": "E-Mail zuerst global konfigurieren und aktivieren.",
+ "ntfyChannelHintEnabled": "Passende Arbeitsbereichs-Benachrichtigungen an ntfy senden.",
+ "ntfyChannelHintDisabled": "ntfy zuerst global konfigurieren und aktivieren.",
+ "webhookChannelHintEnabled": "Passende Arbeitsbereichs-Benachrichtigungen an deinen Webhook senden.",
+ "webhookChannelHintDisabled": "Webhook zuerst global konfigurieren und aktivieren.",
+ "projectScope": "Projektbereich",
+ "projectScopeDescription": "Standardmäßig sind alle Projekte enthalten. Schränke ein, wenn dieser Arbeitsbereich nur ausgewählte Projekte benachrichtigen soll.",
+ "allProjects": "Alle Projekte",
+ "allProjectsDescription": "Benachrichtigungen aus jedem Projekt in diesem Arbeitsbereich zustellen.",
+ "selectedProjects": "Ausgewählte Projekte",
+ "selectedProjectsDescription": "Nur Benachrichtigungen aus gewählten Projekten zustellen.",
+ "noProjectsInWorkspace": "Für diesen Arbeitsbereich sind noch keine Projekte vorhanden.",
+ "createRule": "Regel erstellen",
+ "removeRule": "Regel entfernen",
+ "toastEmailSaved": "E-Mail-Benachrichtigungseinstellungen gespeichert",
+ "toastEmailSaveFailed": "E-Mail-Einstellungen konnten nicht gespeichert werden",
+ "toastNtfySaved": "ntfy-Einstellungen gespeichert",
+ "toastNtfySaveFailed": "ntfy-Einstellungen konnten nicht gespeichert werden",
+ "toastNtfyDisconnected": "ntfy getrennt",
+ "toastNtfyDisconnectFailed": "ntfy konnte nicht getrennt werden",
+ "toastWebhookSaved": "Webhook-Einstellungen gespeichert",
+ "toastWebhookSaveFailed": "Webhook-Einstellungen konnten nicht gespeichert werden",
+ "toastWebhookDisconnected": "Webhook getrennt",
+ "toastWebhookDisconnectFailed": "Webhook konnte nicht getrennt werden",
+ "toastRuleSaved": "Benachrichtigungsregel für {{workspaceName}} gespeichert",
+ "toastRuleSaveFailed": "Arbeitsbereichs-Benachrichtigungsregel konnte nicht gespeichert werden",
+ "toastRuleRemoved": "Benachrichtigungsregel für {{workspaceName}} entfernt",
+ "toastRuleRemoveFailed": "Arbeitsbereichs-Benachrichtigungsregel konnte nicht entfernt werden"
+ },
"preferencesPage": {
"title": "Einstellungen",
"subtitle": "Passe dein Kaneo-Erlebnis an.",
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index c5dd05052..fb7c5a11a 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -298,6 +298,7 @@
"account": "Λογαριασμός",
"developer": "Προγραμματιστής",
"information": "Πληροφορίες",
+ "notifications": "Ειδοποιήσεις",
"preferences": "Προτιμήσεις",
"apiKeys": "Κλειδιά API",
"informationPage": {
@@ -319,6 +320,75 @@
"invalidEmail": "Μη έγκυρη διεύθυνση email"
}
},
+ "notificationsPage": {
+ "pageTitle": "Ειδοποιήσεις",
+ "title": "Ειδοποιήσεις",
+ "subtitle": "Επιλέξτε πώς το Kaneo παραδίδει τις ειδοποιήσεις λογαριασμού και ποια κανάλια θα χρησιμοποιούνται.",
+ "statusConnected": "Συνδεδεμένο",
+ "statusPaused": "Σε παύση",
+ "emailTitle": "Email",
+ "emailDescription": "Χρησιμοποιήστε το email του λογαριασμού ως προορισμό για ειδοποιήσεις.",
+ "accountEmailLabel": "Email λογαριασμού",
+ "accountEmailNoAddress": "Δεν υπάρχει διαθέσιμο email λογαριασμού",
+ "accountEmailHint": "Η παράδοση email πηγαίνει πάντα στο email του συνδεδεμένου λογαριασμού.",
+ "saveChanges": "Αποθήκευση αλλαγών",
+ "disconnect": "Αποσύνδεση",
+ "ntfyTitle": "ntfy",
+ "ntfyDescription": "Δημοσιεύστε ειδοποιήσεις λογαριασμού σε θέμα ntfy.",
+ "serverUrl": "URL διακομιστή",
+ "topic": "Θέμα",
+ "token": "Διακριτικό",
+ "ntfyServerPlaceholder": "https://ntfy.example.com",
+ "ntfyTopicPlaceholder": "team-alerts",
+ "ntfyTokenPlaceholder": "Προαιρετικό bearer token",
+ "ntfyTokenHintConfigured": "Ένα διακριτικό έχει ήδη ρυθμιστεί ({{masked}}). Εισαγάγετε νέο για αντικατάσταση.",
+ "ntfyTokenHintOptional": "Προαιρετικό. Δώστε διακριτικό αν ο διακομιστής ntfy απαιτεί πιστοποίηση.",
+ "connectNtfy": "Σύνδεση ntfy",
+ "webhookTitle": "Προσαρμοσμένο webhook",
+ "webhookDescription": "Στείλτε ειδοποιήσεις λογαριασμού στο δικό σας endpoint ως JSON.",
+ "endpointUrl": "URL τελικού σημείου",
+ "signingSecret": "Μυστικό υπογραφής",
+ "webhookUrlPlaceholder": "https://example.com/webhooks/kaneo",
+ "webhookSecretPlaceholder": "Προαιρετικό κοινό μυστικό",
+ "webhookSecretHintConfigured": "Ένα μυστικό υπογραφής έχει ήδη ρυθμιστεί ({{masked}}). Εισαγάγετε νέο για αντικατάσταση.",
+ "webhookSecretHintOptional": "Προαιρετικό. Το Kaneo υπογράφει το σώμα αιτήματος όταν έχει οριστεί μυστικό.",
+ "connectWebhook": "Σύνδεση webhook",
+ "workspaceRulesTitle": "Κανόνες παράδοσης χώρου εργασίας",
+ "workspaceRulesDescription": "Επαναχρησιμοποιήστε τα καθολικά κανάλια και επιλέξτε ποιοι χώροι εργασίας και έργα επιτρέπεται να στέλνουν ειδοποιήσεις λογαριασμού.",
+ "workspaceCardHint": "Επιλέξτε ποια κανάλια μπορεί να χρησιμοποιεί αυτός ο χώρος εργασίας για ειδοποιήσεις λογαριασμού.",
+ "workspaceCardLabelEmail": "Email",
+ "workspaceCardLabelNtfy": "ntfy",
+ "workspaceCardLabelWebhook": "Προσαρμοσμένο webhook",
+ "emailChannelHintEnabled": "Αποστολή αντίστοιχων ειδοποιήσεων χώρου εργασίας μέσω email.",
+ "emailChannelHintDisabled": "Ρυθμίστε και ενεργοποιήστε πρώτα το email καθολικά.",
+ "ntfyChannelHintEnabled": "Αποστολή αντίστοιχων ειδοποιήσεων χώρου εργασίας στο ntfy.",
+ "ntfyChannelHintDisabled": "Ρυθμίστε και ενεργοποιήστε πρώτα το ntfy καθολικά.",
+ "webhookChannelHintEnabled": "Αποστολή αντίστοιχων ειδοποιήσεων χώρου εργασίας στο webhook σας.",
+ "webhookChannelHintDisabled": "Ρυθμίστε και ενεργοποιήστε πρώτα το webhook καθολικά.",
+ "projectScope": "Εύρος έργων",
+ "projectScopeDescription": "Όλα τα έργα περιλαμβάνονται από προεπιλογή. Περιορίστε αν αυτός ο χώρος εργασίας πρέπει να στέλνει ειδοποιήσεις μόνο από επιλεγμένα έργα.",
+ "allProjects": "Όλα τα έργα",
+ "allProjectsDescription": "Παράδοση ειδοποιήσεων από κάθε έργο σε αυτόν τον χώρο εργασίας.",
+ "selectedProjects": "Επιλεγμένα έργα",
+ "selectedProjectsDescription": "Παράδοση ειδοποιήσεων μόνο από επιλεγμένα έργα.",
+ "noProjectsInWorkspace": "Δεν υπάρχουν ακόμα διαθέσιμα έργα για αυτόν τον χώρο εργασίας.",
+ "createRule": "Δημιουργία κανόνα",
+ "removeRule": "Αφαίρεση κανόνα",
+ "toastEmailSaved": "Οι ρυθμίσεις ειδοποιήσεων email αποθηκεύτηκαν",
+ "toastEmailSaveFailed": "Αποτυχία αποθήκευσης ρυθμίσεων email",
+ "toastNtfySaved": "Οι ρυθμίσεις ntfy αποθηκεύτηκαν",
+ "toastNtfySaveFailed": "Αποτυχία αποθήκευσης ρυθμίσεων ntfy",
+ "toastNtfyDisconnected": "Το ntfy αποσυνδέθηκε",
+ "toastNtfyDisconnectFailed": "Αποτυχία αποσύνδεσης ntfy",
+ "toastWebhookSaved": "Οι ρυθμίσεις webhook αποθηκεύτηκαν",
+ "toastWebhookSaveFailed": "Αποτυχία αποθήκευσης ρυθμίσεων webhook",
+ "toastWebhookDisconnected": "Το webhook αποσυνδέθηκε",
+ "toastWebhookDisconnectFailed": "Αποτυχία αποσύνδεσης webhook",
+ "toastRuleSaved": "Αποθηκεύτηκε ο κανόνας ειδοποίησης για {{workspaceName}}",
+ "toastRuleSaveFailed": "Αποτυχία αποθήκευσης κανόνα ειδοποίησης χώρου εργασίας",
+ "toastRuleRemoved": "Αφαιρέθηκε ο κανόνας ειδοποίησης για {{workspaceName}}",
+ "toastRuleRemoveFailed": "Αποτυχία αφαίρεσης κανόνα ειδοποίησης χώρου εργασίας"
+ },
"preferencesPage": {
"title": "Προτιμήσεις",
"subtitle": "Προσαρμόστε την εμπειρία σας στο Kaneo.",
diff --git a/i18n/en-US.json b/i18n/en-US.json
index ccb9a385a..aaeddfa25 100644
--- a/i18n/en-US.json
+++ b/i18n/en-US.json
@@ -298,6 +298,7 @@
"account": "Account",
"developer": "Developer",
"information": "Information",
+ "notifications": "Notifications",
"preferences": "Preferences",
"apiKeys": "API Keys",
"informationPage": {
@@ -319,6 +320,75 @@
"invalidEmail": "Invalid email address"
}
},
+ "notificationsPage": {
+ "pageTitle": "Notifications",
+ "title": "Notifications",
+ "subtitle": "Choose how Kaneo delivers your account notifications and which channels to use.",
+ "statusConnected": "Connected",
+ "statusPaused": "Paused",
+ "emailTitle": "Email",
+ "emailDescription": "Use your account email as the destination for notifications.",
+ "accountEmailLabel": "Account email",
+ "accountEmailNoAddress": "No account email available",
+ "accountEmailHint": "Email delivery always goes to the signed-in account email.",
+ "saveChanges": "Save changes",
+ "disconnect": "Disconnect",
+ "ntfyTitle": "ntfy",
+ "ntfyDescription": "Publish account notifications to an ntfy topic.",
+ "serverUrl": "Server URL",
+ "topic": "Topic",
+ "token": "Token",
+ "ntfyServerPlaceholder": "https://ntfy.example.com",
+ "ntfyTopicPlaceholder": "team-alerts",
+ "ntfyTokenPlaceholder": "Optional bearer token",
+ "ntfyTokenHintConfigured": "A token is already configured ({{masked}}). Enter a new token to replace it.",
+ "ntfyTokenHintOptional": "Optional. Provide a token if your ntfy server requires authentication.",
+ "connectNtfy": "Connect ntfy",
+ "webhookTitle": "Custom webhook",
+ "webhookDescription": "Send account notifications to your own endpoint as JSON.",
+ "endpointUrl": "Endpoint URL",
+ "signingSecret": "Signing secret",
+ "webhookUrlPlaceholder": "https://example.com/webhooks/kaneo",
+ "webhookSecretPlaceholder": "Optional shared secret",
+ "webhookSecretHintConfigured": "A signing secret is already configured ({{masked}}). Enter a new one to replace it.",
+ "webhookSecretHintOptional": "Optional. Kaneo signs the request body when a secret is set.",
+ "connectWebhook": "Connect webhook",
+ "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.",
+ "workspaceCardLabelEmail": "Email",
+ "workspaceCardLabelNtfy": "ntfy",
+ "workspaceCardLabelWebhook": "Custom webhook",
+ "emailChannelHintEnabled": "Send matching workspace notifications by email.",
+ "emailChannelHintDisabled": "Configure and enable email globally first.",
+ "ntfyChannelHintEnabled": "Send matching workspace notifications to ntfy.",
+ "ntfyChannelHintDisabled": "Configure and enable ntfy globally first.",
+ "webhookChannelHintEnabled": "Send matching workspace notifications to your webhook.",
+ "webhookChannelHintDisabled": "Configure and enable the webhook globally first.",
+ "projectScope": "Project scope",
+ "projectScopeDescription": "All projects are included by default. Narrow it down if this workspace should only send notifications from selected projects.",
+ "allProjects": "All projects",
+ "allProjectsDescription": "Deliver notifications from every project in this workspace.",
+ "selectedProjects": "Selected projects",
+ "selectedProjectsDescription": "Only deliver notifications from chosen projects.",
+ "noProjectsInWorkspace": "No projects available for this workspace yet.",
+ "createRule": "Create rule",
+ "removeRule": "Remove rule",
+ "toastEmailSaved": "Email notification settings saved",
+ "toastEmailSaveFailed": "Failed to save email settings",
+ "toastNtfySaved": "ntfy settings saved",
+ "toastNtfySaveFailed": "Failed to save ntfy settings",
+ "toastNtfyDisconnected": "ntfy disconnected",
+ "toastNtfyDisconnectFailed": "Failed to disconnect ntfy",
+ "toastWebhookSaved": "Webhook settings saved",
+ "toastWebhookSaveFailed": "Failed to save webhook settings",
+ "toastWebhookDisconnected": "Webhook disconnected",
+ "toastWebhookDisconnectFailed": "Failed to disconnect webhook",
+ "toastRuleSaved": "Saved notification rule for {{workspaceName}}",
+ "toastRuleSaveFailed": "Failed to save workspace notification rule",
+ "toastRuleRemoved": "Removed notification rule for {{workspaceName}}",
+ "toastRuleRemoveFailed": "Failed to remove workspace notification rule"
+ },
"preferencesPage": {
"title": "Preferences",
"subtitle": "Customize your Kaneo experience.",
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index b8adf688a..3555446e5 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -298,6 +298,7 @@
"account": "Compte",
"developer": "Développeur",
"information": "Information",
+ "notifications": "Notifications",
"preferences": "Préférences",
"apiKeys": "Clés API",
"informationPage": {
@@ -319,6 +320,75 @@
"invalidEmail": "Adresse email invalide"
}
},
+ "notificationsPage": {
+ "pageTitle": "Notifications",
+ "title": "Notifications",
+ "subtitle": "Choisissez comment Kaneo envoie les notifications de compte et quels canaux utiliser.",
+ "statusConnected": "Connecté",
+ "statusPaused": "En pause",
+ "emailTitle": "E-mail",
+ "emailDescription": "Utilisez l’e-mail du compte comme destination des notifications.",
+ "accountEmailLabel": "E-mail du compte",
+ "accountEmailNoAddress": "Aucun e-mail de compte disponible",
+ "accountEmailHint": "La livraison par e-mail va toujours à l’e-mail du compte connecté.",
+ "saveChanges": "Enregistrer les modifications",
+ "disconnect": "Déconnecter",
+ "ntfyTitle": "ntfy",
+ "ntfyDescription": "Publier les notifications de compte sur un sujet ntfy.",
+ "serverUrl": "URL du serveur",
+ "topic": "Sujet",
+ "token": "Jeton",
+ "ntfyServerPlaceholder": "https://ntfy.example.com",
+ "ntfyTopicPlaceholder": "team-alerts",
+ "ntfyTokenPlaceholder": "Jeton Bearer facultatif",
+ "ntfyTokenHintConfigured": "Un jeton est déjà configuré ({{masked}}). Saisissez-en un nouveau pour le remplacer.",
+ "ntfyTokenHintOptional": "Facultatif. Indiquez un jeton si votre serveur ntfy exige une authentification.",
+ "connectNtfy": "Connecter ntfy",
+ "webhookTitle": "Webhook personnalisé",
+ "webhookDescription": "Envoyer les notifications de compte vers votre propre point de terminaison en JSON.",
+ "endpointUrl": "URL du point de terminaison",
+ "signingSecret": "Secret de signature",
+ "webhookUrlPlaceholder": "https://example.com/webhooks/kaneo",
+ "webhookSecretPlaceholder": "Secret partagé facultatif",
+ "webhookSecretHintConfigured": "Un secret de signature est déjà configuré ({{masked}}). Saisissez-en un nouveau pour le remplacer.",
+ "webhookSecretHintOptional": "Facultatif. Kaneo signe le corps de la requête lorsqu’un secret est défini.",
+ "connectWebhook": "Connecter le webhook",
+ "workspaceRulesTitle": "Règles de livraison par espace de travail",
+ "workspaceRulesDescription": "Réutilisez vos canaux globaux, puis choisissez quels espaces de travail et projets peuvent envoyer des notifications de compte.",
+ "workspaceCardHint": "Choisissez les canaux que cet espace de travail peut utiliser pour les notifications de compte.",
+ "workspaceCardLabelEmail": "E-mail",
+ "workspaceCardLabelNtfy": "ntfy",
+ "workspaceCardLabelWebhook": "Webhook personnalisé",
+ "emailChannelHintEnabled": "Envoyer les notifications d’espace de travail correspondantes par e-mail.",
+ "emailChannelHintDisabled": "Configurez et activez d’abord l’e-mail globalement.",
+ "ntfyChannelHintEnabled": "Envoyer les notifications d’espace de travail correspondantes vers ntfy.",
+ "ntfyChannelHintDisabled": "Configurez et activez d’abord ntfy globalement.",
+ "webhookChannelHintEnabled": "Envoyer les notifications d’espace de travail correspondantes vers votre webhook.",
+ "webhookChannelHintDisabled": "Configurez et activez d’abord le webhook globalement.",
+ "projectScope": "Portée des projets",
+ "projectScopeDescription": "Tous les projets sont inclus par défaut. Restreignez si cet espace de travail ne doit envoyer des notifications que pour certains projets.",
+ "allProjects": "Tous les projets",
+ "allProjectsDescription": "Livrer les notifications de chaque projet de cet espace de travail.",
+ "selectedProjects": "Projets sélectionnés",
+ "selectedProjectsDescription": "Ne livrer les notifications que pour les projets choisis.",
+ "noProjectsInWorkspace": "Aucun projet disponible pour cet espace de travail pour le moment.",
+ "createRule": "Créer une règle",
+ "removeRule": "Supprimer la règle",
+ "toastEmailSaved": "Paramètres de notification par e-mail enregistrés",
+ "toastEmailSaveFailed": "Échec de l’enregistrement des paramètres e-mail",
+ "toastNtfySaved": "Paramètres ntfy enregistrés",
+ "toastNtfySaveFailed": "Échec de l’enregistrement des paramètres ntfy",
+ "toastNtfyDisconnected": "ntfy déconnecté",
+ "toastNtfyDisconnectFailed": "Échec de la déconnexion de ntfy",
+ "toastWebhookSaved": "Paramètres du webhook enregistrés",
+ "toastWebhookSaveFailed": "Échec de l’enregistrement des paramètres du webhook",
+ "toastWebhookDisconnected": "Webhook déconnecté",
+ "toastWebhookDisconnectFailed": "Échec de la déconnexion du webhook",
+ "toastRuleSaved": "Règle de notification enregistrée pour {{workspaceName}}",
+ "toastRuleSaveFailed": "Échec de l’enregistrement de la règle de notification de l’espace de travail",
+ "toastRuleRemoved": "Règle de notification supprimée pour {{workspaceName}}",
+ "toastRuleRemoveFailed": "Échec de la suppression de la règle de notification de l’espace de travail"
+ },
"preferencesPage": {
"title": "Préférences",
"subtitle": "Personnalisez votre expérience Kaneo.",
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index df689050d..a32d1abc4 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -298,6 +298,7 @@
"account": "Сметка",
"developer": "Програмер",
"information": "Информации",
+ "notifications": "Известувања",
"preferences": "Преференции",
"apiKeys": "API клучеви",
"informationPage": {
@@ -319,6 +320,75 @@
"invalidEmail": "Невалидна е-пошта"
}
},
+ "notificationsPage": {
+ "pageTitle": "Известувања",
+ "title": "Известувања",
+ "subtitle": "Одбери како Kaneo ги испорачува известувањата за сметката и кои канали да се користат.",
+ "statusConnected": "Поврзано",
+ "statusPaused": "Паузирано",
+ "emailTitle": "Е-пошта",
+ "emailDescription": "Користи ја е-поштата на сметката како одредиште за известувања.",
+ "accountEmailLabel": "Е-пошта на сметката",
+ "accountEmailNoAddress": "Нема достапна е-пошта на сметката",
+ "accountEmailHint": "Испораката по е-пошта секогаш оди на е-поштата на најавената сметка.",
+ "saveChanges": "Зачувај промени",
+ "disconnect": "Исклучи",
+ "ntfyTitle": "ntfy",
+ "ntfyDescription": "Објавувај известувања за сметката на ntfy тема.",
+ "serverUrl": "URL на сервер",
+ "topic": "Тема",
+ "token": "Токен",
+ "ntfyServerPlaceholder": "https://ntfy.example.com",
+ "ntfyTopicPlaceholder": "team-alerts",
+ "ntfyTokenPlaceholder": "Опционален bearer токен",
+ "ntfyTokenHintConfigured": "Токенот веќе е конфигуриран ({{masked}}). Внеси нов за да го замениш.",
+ "ntfyTokenHintOptional": "Опционално. Дај токен ако ntfy серверот бара автентикација.",
+ "connectNtfy": "Поврзи ntfy",
+ "webhookTitle": "Прилагоден webhook",
+ "webhookDescription": "Испрати известувања за сметката до сопствениот endpoint како JSON.",
+ "endpointUrl": "URL на endpoint",
+ "signingSecret": "Тајна за потпис",
+ "webhookUrlPlaceholder": "https://example.com/webhooks/kaneo",
+ "webhookSecretPlaceholder": "Опционална заедничка тајна",
+ "webhookSecretHintConfigured": "Тајна за потпис веќе е конфигурирана ({{masked}}). Внеси нова за да ја замениш.",
+ "webhookSecretHintOptional": "Опционално. Kaneo го потпишува телото на барањето кога е поставена тајна.",
+ "connectWebhook": "Поврзи webhook",
+ "workspaceRulesTitle": "Правила за испорака по работен простор",
+ "workspaceRulesDescription": "Повторно користи глобални канали, па одреди кои работни простори и проекти смеат да испраќаат известувања за сметката.",
+ "workspaceCardHint": "Одбери кои канали овој работен простор може да ги користи за известувања за сметката.",
+ "workspaceCardLabelEmail": "Е-пошта",
+ "workspaceCardLabelNtfy": "ntfy",
+ "workspaceCardLabelWebhook": "Прилагоден webhook",
+ "emailChannelHintEnabled": "Испрати соодветни известувања за работниот простор по е-пошта.",
+ "emailChannelHintDisabled": "Прво конфигурирај и овозможи е-пошта глобално.",
+ "ntfyChannelHintEnabled": "Испрати соодветни известувања за работниот простор до ntfy.",
+ "ntfyChannelHintDisabled": "Прво конфигурирај и овозможи ntfy глобално.",
+ "webhookChannelHintEnabled": "Испрати соодветни известувања за работниот простор до твојот webhook.",
+ "webhookChannelHintDisabled": "Прво конфигурирај и овозможи webhook глобално.",
+ "projectScope": "Опсег на проекти",
+ "projectScopeDescription": "Сите проекти се вклучени по подразбирање. Сузи ако овој работен простор треба да испраќа известувања само од избрани проекти.",
+ "allProjects": "Сите проекти",
+ "allProjectsDescription": "Испорачи известувања од секој проект во овој работен простор.",
+ "selectedProjects": "Избрани проекти",
+ "selectedProjectsDescription": "Испорачи известувања само од избрани проекти.",
+ "noProjectsInWorkspace": "Сè уште нема достапни проекти за овој работен простор.",
+ "createRule": "Создај правило",
+ "removeRule": "Отстрани правило",
+ "toastEmailSaved": "Зачувани се поставките за известувања по е-пошта",
+ "toastEmailSaveFailed": "Не успеа зачувувањето на поставките за е-пошта",
+ "toastNtfySaved": "Зачувани се ntfy поставките",
+ "toastNtfySaveFailed": "Не успеа зачувувањето на ntfy поставките",
+ "toastNtfyDisconnected": "ntfy е исклучен",
+ "toastNtfyDisconnectFailed": "Не успеа исклучувањето на ntfy",
+ "toastWebhookSaved": "Зачувани се webhook поставките",
+ "toastWebhookSaveFailed": "Не успеа зачувувањето на webhook поставките",
+ "toastWebhookDisconnected": "Webhook е исклучен",
+ "toastWebhookDisconnectFailed": "Не успеа исклучувањето на webhook",
+ "toastRuleSaved": "Зачувано е правилото за известување за {{workspaceName}}",
+ "toastRuleSaveFailed": "Не успеа зачувувањето на правилото за известување за работниот простор",
+ "toastRuleRemoved": "Отстрането е правилото за известување за {{workspaceName}}",
+ "toastRuleRemoveFailed": "Не успеа отстранувањето на правилото за известување за работниот простор"
+ },
"preferencesPage": {
"title": "Преференции",
"subtitle": "Прилагоди го твоето Kaneo искуство.",
diff --git a/i18n/schema.json b/i18n/schema.json
index e985907fe..589afc926 100644
--- a/i18n/schema.json
+++ b/i18n/schema.json
@@ -1183,6 +1183,9 @@
"information": {
"type": "string"
},
+ "notifications": {
+ "type": "string"
+ },
"preferences": {
"type": "string"
},
@@ -1262,6 +1265,282 @@
"validation"
]
},
+ "notificationsPage": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "pageTitle": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "subtitle": {
+ "type": "string"
+ },
+ "statusConnected": {
+ "type": "string"
+ },
+ "statusPaused": {
+ "type": "string"
+ },
+ "emailTitle": {
+ "type": "string"
+ },
+ "emailDescription": {
+ "type": "string"
+ },
+ "accountEmailLabel": {
+ "type": "string"
+ },
+ "accountEmailNoAddress": {
+ "type": "string"
+ },
+ "accountEmailHint": {
+ "type": "string"
+ },
+ "saveChanges": {
+ "type": "string"
+ },
+ "disconnect": {
+ "type": "string"
+ },
+ "ntfyTitle": {
+ "type": "string"
+ },
+ "ntfyDescription": {
+ "type": "string"
+ },
+ "serverUrl": {
+ "type": "string"
+ },
+ "topic": {
+ "type": "string"
+ },
+ "token": {
+ "type": "string"
+ },
+ "ntfyServerPlaceholder": {
+ "type": "string"
+ },
+ "ntfyTopicPlaceholder": {
+ "type": "string"
+ },
+ "ntfyTokenPlaceholder": {
+ "type": "string"
+ },
+ "ntfyTokenHintConfigured": {
+ "type": "string"
+ },
+ "ntfyTokenHintOptional": {
+ "type": "string"
+ },
+ "connectNtfy": {
+ "type": "string"
+ },
+ "webhookTitle": {
+ "type": "string"
+ },
+ "webhookDescription": {
+ "type": "string"
+ },
+ "endpointUrl": {
+ "type": "string"
+ },
+ "signingSecret": {
+ "type": "string"
+ },
+ "webhookUrlPlaceholder": {
+ "type": "string"
+ },
+ "webhookSecretPlaceholder": {
+ "type": "string"
+ },
+ "webhookSecretHintConfigured": {
+ "type": "string"
+ },
+ "webhookSecretHintOptional": {
+ "type": "string"
+ },
+ "connectWebhook": {
+ "type": "string"
+ },
+ "workspaceRulesTitle": {
+ "type": "string"
+ },
+ "workspaceRulesDescription": {
+ "type": "string"
+ },
+ "workspaceCardHint": {
+ "type": "string"
+ },
+ "workspaceCardLabelEmail": {
+ "type": "string"
+ },
+ "workspaceCardLabelNtfy": {
+ "type": "string"
+ },
+ "workspaceCardLabelWebhook": {
+ "type": "string"
+ },
+ "emailChannelHintEnabled": {
+ "type": "string"
+ },
+ "emailChannelHintDisabled": {
+ "type": "string"
+ },
+ "ntfyChannelHintEnabled": {
+ "type": "string"
+ },
+ "ntfyChannelHintDisabled": {
+ "type": "string"
+ },
+ "webhookChannelHintEnabled": {
+ "type": "string"
+ },
+ "webhookChannelHintDisabled": {
+ "type": "string"
+ },
+ "projectScope": {
+ "type": "string"
+ },
+ "projectScopeDescription": {
+ "type": "string"
+ },
+ "allProjects": {
+ "type": "string"
+ },
+ "allProjectsDescription": {
+ "type": "string"
+ },
+ "selectedProjects": {
+ "type": "string"
+ },
+ "selectedProjectsDescription": {
+ "type": "string"
+ },
+ "noProjectsInWorkspace": {
+ "type": "string"
+ },
+ "createRule": {
+ "type": "string"
+ },
+ "removeRule": {
+ "type": "string"
+ },
+ "toastEmailSaved": {
+ "type": "string"
+ },
+ "toastEmailSaveFailed": {
+ "type": "string"
+ },
+ "toastNtfySaved": {
+ "type": "string"
+ },
+ "toastNtfySaveFailed": {
+ "type": "string"
+ },
+ "toastNtfyDisconnected": {
+ "type": "string"
+ },
+ "toastNtfyDisconnectFailed": {
+ "type": "string"
+ },
+ "toastWebhookSaved": {
+ "type": "string"
+ },
+ "toastWebhookSaveFailed": {
+ "type": "string"
+ },
+ "toastWebhookDisconnected": {
+ "type": "string"
+ },
+ "toastWebhookDisconnectFailed": {
+ "type": "string"
+ },
+ "toastRuleSaved": {
+ "type": "string"
+ },
+ "toastRuleSaveFailed": {
+ "type": "string"
+ },
+ "toastRuleRemoved": {
+ "type": "string"
+ },
+ "toastRuleRemoveFailed": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "pageTitle",
+ "title",
+ "subtitle",
+ "statusConnected",
+ "statusPaused",
+ "emailTitle",
+ "emailDescription",
+ "accountEmailLabel",
+ "accountEmailNoAddress",
+ "accountEmailHint",
+ "saveChanges",
+ "disconnect",
+ "ntfyTitle",
+ "ntfyDescription",
+ "serverUrl",
+ "topic",
+ "token",
+ "ntfyServerPlaceholder",
+ "ntfyTopicPlaceholder",
+ "ntfyTokenPlaceholder",
+ "ntfyTokenHintConfigured",
+ "ntfyTokenHintOptional",
+ "connectNtfy",
+ "webhookTitle",
+ "webhookDescription",
+ "endpointUrl",
+ "signingSecret",
+ "webhookUrlPlaceholder",
+ "webhookSecretPlaceholder",
+ "webhookSecretHintConfigured",
+ "webhookSecretHintOptional",
+ "connectWebhook",
+ "workspaceRulesTitle",
+ "workspaceRulesDescription",
+ "workspaceCardHint",
+ "workspaceCardLabelEmail",
+ "workspaceCardLabelNtfy",
+ "workspaceCardLabelWebhook",
+ "emailChannelHintEnabled",
+ "emailChannelHintDisabled",
+ "ntfyChannelHintEnabled",
+ "ntfyChannelHintDisabled",
+ "webhookChannelHintEnabled",
+ "webhookChannelHintDisabled",
+ "projectScope",
+ "projectScopeDescription",
+ "allProjects",
+ "allProjectsDescription",
+ "selectedProjects",
+ "selectedProjectsDescription",
+ "noProjectsInWorkspace",
+ "createRule",
+ "removeRule",
+ "toastEmailSaved",
+ "toastEmailSaveFailed",
+ "toastNtfySaved",
+ "toastNtfySaveFailed",
+ "toastNtfyDisconnected",
+ "toastNtfyDisconnectFailed",
+ "toastWebhookSaved",
+ "toastWebhookSaveFailed",
+ "toastWebhookDisconnected",
+ "toastWebhookDisconnectFailed",
+ "toastRuleSaved",
+ "toastRuleSaveFailed",
+ "toastRuleRemoved",
+ "toastRuleRemoveFailed"
+ ]
+ },
"preferencesPage": {
"type": "object",
"additionalProperties": false,
@@ -1951,6 +2230,24 @@
},
"githubSectionSubtitle": {
"type": "string"
+ },
+ "discordSectionTitle": {
+ "type": "string"
+ },
+ "discordSectionSubtitle": {
+ "type": "string"
+ },
+ "genericWebhookSectionTitle": {
+ "type": "string"
+ },
+ "genericWebhookSectionSubtitle": {
+ "type": "string"
+ },
+ "slackSectionTitle": {
+ "type": "string"
+ },
+ "slackSectionSubtitle": {
+ "type": "string"
}
},
"required": [
@@ -1958,7 +2255,13 @@
"title",
"subtitle",
"githubSectionTitle",
- "githubSectionSubtitle"
+ "githubSectionSubtitle",
+ "discordSectionTitle",
+ "discordSectionSubtitle",
+ "genericWebhookSectionTitle",
+ "genericWebhookSectionSubtitle",
+ "slackSectionTitle",
+ "slackSectionSubtitle"
]
},
"projectVisibility": {
@@ -2392,6 +2695,465 @@
"importDisabledHint"
]
},
+ "slackIntegration": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "validation": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "webhookInvalid": {
+ "type": "string"
+ }
+ },
+ "required": ["webhookInvalid"]
+ },
+ "toast": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "saved": {
+ "type": "string"
+ },
+ "saveError": {
+ "type": "string"
+ },
+ "enabled": {
+ "type": "string"
+ },
+ "disabled": {
+ "type": "string"
+ },
+ "updateError": {
+ "type": "string"
+ },
+ "removed": {
+ "type": "string"
+ },
+ "removeError": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "saved",
+ "saveError",
+ "enabled",
+ "disabled",
+ "updateError",
+ "removed",
+ "removeError"
+ ]
+ },
+ "connectionTitle": {
+ "type": "string"
+ },
+ "connectionHint": {
+ "type": "string"
+ },
+ "connected": {
+ "type": "string"
+ },
+ "paused": {
+ "type": "string"
+ },
+ "webhookLabel": {
+ "type": "string"
+ },
+ "webhookPlaceholder": {
+ "type": "string"
+ },
+ "webhookHint": {
+ "type": "string"
+ },
+ "channelLabel": {
+ "type": "string"
+ },
+ "channelPlaceholder": {
+ "type": "string"
+ },
+ "channelHint": {
+ "type": "string"
+ },
+ "eventsTitle": {
+ "type": "string"
+ },
+ "eventsHint": {
+ "type": "string"
+ },
+ "events": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "taskCreated": {
+ "type": "string"
+ },
+ "taskStatusChanged": {
+ "type": "string"
+ },
+ "taskPriorityChanged": {
+ "type": "string"
+ },
+ "taskTitleChanged": {
+ "type": "string"
+ },
+ "taskDescriptionChanged": {
+ "type": "string"
+ },
+ "taskCommentCreated": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "taskCreated",
+ "taskStatusChanged",
+ "taskPriorityChanged",
+ "taskTitleChanged",
+ "taskDescriptionChanged",
+ "taskCommentCreated"
+ ]
+ },
+ "connect": {
+ "type": "string"
+ },
+ "saveChanges": {
+ "type": "string"
+ },
+ "update": {
+ "type": "string"
+ },
+ "disconnect": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "validation",
+ "toast",
+ "connectionTitle",
+ "connectionHint",
+ "connected",
+ "paused",
+ "webhookLabel",
+ "webhookPlaceholder",
+ "webhookHint",
+ "channelLabel",
+ "channelPlaceholder",
+ "channelHint",
+ "eventsTitle",
+ "eventsHint",
+ "events",
+ "connect",
+ "saveChanges",
+ "update",
+ "disconnect"
+ ]
+ },
+ "discordIntegration": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "validation": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "webhookInvalid": {
+ "type": "string"
+ }
+ },
+ "required": ["webhookInvalid"]
+ },
+ "toast": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "saved": {
+ "type": "string"
+ },
+ "saveError": {
+ "type": "string"
+ },
+ "enabled": {
+ "type": "string"
+ },
+ "disabled": {
+ "type": "string"
+ },
+ "updateError": {
+ "type": "string"
+ },
+ "removed": {
+ "type": "string"
+ },
+ "removeError": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "saved",
+ "saveError",
+ "enabled",
+ "disabled",
+ "updateError",
+ "removed",
+ "removeError"
+ ]
+ },
+ "connectionTitle": {
+ "type": "string"
+ },
+ "connectionHint": {
+ "type": "string"
+ },
+ "connected": {
+ "type": "string"
+ },
+ "paused": {
+ "type": "string"
+ },
+ "webhookLabel": {
+ "type": "string"
+ },
+ "webhookPlaceholder": {
+ "type": "string"
+ },
+ "webhookHint": {
+ "type": "string"
+ },
+ "channelLabel": {
+ "type": "string"
+ },
+ "channelPlaceholder": {
+ "type": "string"
+ },
+ "channelHint": {
+ "type": "string"
+ },
+ "eventsTitle": {
+ "type": "string"
+ },
+ "eventsHint": {
+ "type": "string"
+ },
+ "events": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "taskCreated": {
+ "type": "string"
+ },
+ "taskStatusChanged": {
+ "type": "string"
+ },
+ "taskPriorityChanged": {
+ "type": "string"
+ },
+ "taskTitleChanged": {
+ "type": "string"
+ },
+ "taskDescriptionChanged": {
+ "type": "string"
+ },
+ "taskCommentCreated": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "taskCreated",
+ "taskStatusChanged",
+ "taskPriorityChanged",
+ "taskTitleChanged",
+ "taskDescriptionChanged",
+ "taskCommentCreated"
+ ]
+ },
+ "connect": {
+ "type": "string"
+ },
+ "saveChanges": {
+ "type": "string"
+ },
+ "update": {
+ "type": "string"
+ },
+ "disconnect": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "validation",
+ "toast",
+ "connectionTitle",
+ "connectionHint",
+ "connected",
+ "paused",
+ "webhookLabel",
+ "webhookPlaceholder",
+ "webhookHint",
+ "channelLabel",
+ "channelPlaceholder",
+ "channelHint",
+ "eventsTitle",
+ "eventsHint",
+ "events",
+ "connect",
+ "saveChanges",
+ "update",
+ "disconnect"
+ ]
+ },
+ "genericWebhookIntegration": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "validation": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "webhookInvalid": {
+ "type": "string"
+ }
+ },
+ "required": ["webhookInvalid"]
+ },
+ "toast": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "saved": {
+ "type": "string"
+ },
+ "saveError": {
+ "type": "string"
+ },
+ "enabled": {
+ "type": "string"
+ },
+ "disabled": {
+ "type": "string"
+ },
+ "updateError": {
+ "type": "string"
+ },
+ "removed": {
+ "type": "string"
+ },
+ "removeError": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "saved",
+ "saveError",
+ "enabled",
+ "disabled",
+ "updateError",
+ "removed",
+ "removeError"
+ ]
+ },
+ "connectionTitle": {
+ "type": "string"
+ },
+ "connectionHint": {
+ "type": "string"
+ },
+ "connected": {
+ "type": "string"
+ },
+ "paused": {
+ "type": "string"
+ },
+ "webhookLabel": {
+ "type": "string"
+ },
+ "webhookPlaceholder": {
+ "type": "string"
+ },
+ "webhookHint": {
+ "type": "string"
+ },
+ "secretLabel": {
+ "type": "string"
+ },
+ "secretPlaceholder": {
+ "type": "string"
+ },
+ "secretHint": {
+ "type": "string"
+ },
+ "secretHintConfigured": {
+ "type": "string"
+ },
+ "eventsTitle": {
+ "type": "string"
+ },
+ "eventsHint": {
+ "type": "string"
+ },
+ "events": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "taskCreated": {
+ "type": "string"
+ },
+ "taskStatusChanged": {
+ "type": "string"
+ },
+ "taskPriorityChanged": {
+ "type": "string"
+ },
+ "taskTitleChanged": {
+ "type": "string"
+ },
+ "taskDescriptionChanged": {
+ "type": "string"
+ },
+ "taskCommentCreated": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "taskCreated",
+ "taskStatusChanged",
+ "taskPriorityChanged",
+ "taskTitleChanged",
+ "taskDescriptionChanged",
+ "taskCommentCreated"
+ ]
+ },
+ "connect": {
+ "type": "string"
+ },
+ "saveChanges": {
+ "type": "string"
+ },
+ "disconnect": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "validation",
+ "toast",
+ "connectionTitle",
+ "connectionHint",
+ "connected",
+ "paused",
+ "webhookLabel",
+ "webhookPlaceholder",
+ "webhookHint",
+ "secretLabel",
+ "secretPlaceholder",
+ "secretHint",
+ "secretHintConfigured",
+ "eventsTitle",
+ "eventsHint",
+ "events",
+ "connect",
+ "saveChanges",
+ "disconnect"
+ ]
+ },
"repositoryBrowser": {
"type": "object",
"additionalProperties": false,
@@ -2646,9 +3408,11 @@
"account",
"developer",
"information",
+ "notifications",
"preferences",
"apiKeys",
"informationPage",
+ "notificationsPage",
"preferencesPage",
"developerPage",
"apiKey",
@@ -2660,6 +3424,9 @@
"projectSwitcher",
"columnEditor",
"githubIntegration",
+ "slackIntegration",
+ "discordIntegration",
+ "genericWebhookIntegration",
"repositoryBrowser",
"tasksImportExport",
"workflowEditor",
diff --git a/packages/email/src/index.tsx b/packages/email/src/index.tsx
index 396280b9e..e69183a42 100644
--- a/packages/email/src/index.tsx
+++ b/packages/email/src/index.tsx
@@ -1,5 +1,6 @@
export {
sendMagicLinkEmail,
+ sendNotificationEmail,
sendOtpEmail,
sendPasswordResetEmail,
sendWorkspaceInvitationEmail,
diff --git a/packages/email/src/send-email.tsx b/packages/email/src/send-email.tsx
index 56dd9321a..74b0ea6e9 100644
--- a/packages/email/src/send-email.tsx
+++ b/packages/email/src/send-email.tsx
@@ -3,6 +3,9 @@ import { config } from "dotenv-mono";
import * as nodemailer from "nodemailer";
import type { MagicLinkEmailProps } from "./templates/magic-link";
import MagicLinkEmail from "./templates/magic-link";
+import NotificationEmail, {
+ type NotificationEmailProps,
+} from "./templates/notification";
import type { OtpEmailProps } from "./templates/otp";
import OtpEmail from "./templates/otp";
import PasswordResetEmail, {
@@ -110,3 +113,27 @@ export const sendWorkspaceInvitationEmail = async (
throw error;
}
};
+
+export const sendNotificationEmail = async (
+ to: string,
+ subject: string,
+ data: NotificationEmailProps,
+): Promise<EmailResult> => {
+ if (!process.env.SMTP_HOST || !process.env.SMTP_FROM) {
+ return { success: false, reason: "SMTP_NOT_CONFIGURED" };
+ }
+
+ try {
+ const emailTemplate = await render(NotificationEmail(data));
+ await transporter.sendMail({
+ from: process.env.SMTP_FROM,
+ to,
+ subject,
+ html: emailTemplate,
+ });
+ return { success: true };
+ } catch (error) {
+ console.error("Error sending notification email", error);
+ throw error;
+ }
+};
diff --git a/packages/email/src/templates/notification.tsx b/packages/email/src/templates/notification.tsx
new file mode 100644
index 000000000..efa0af431
--- /dev/null
+++ b/packages/email/src/templates/notification.tsx
@@ -0,0 +1,63 @@
+import { Link, Section, Text } from "@react-email/components";
+import React from "react";
+import { resolveEmailLocale } from "./resolve-locale";
+import { EmailShell, styles } from "./shell";
+
+void React;
+
+export type NotificationEmailProps = {
+ title: string;
+ message: string;
+ actionUrl?: string | null;
+ actionLabel?: string;
+ locale?: string | null;
+};
+
+const messages = {
+ en: {
+ preview: "You have a new Kaneo notification",
+ subtitle: "A notification matched your delivery preferences.",
+ footer: "Kaneo notification",
+ actionLabel: "Open in Kaneo",
+ },
+ de: {
+ preview: "Du hast eine neue Kaneo-Benachrichtigung",
+ subtitle:
+ "Eine Benachrichtigung entspricht deinen Zustellungs-Einstellungen.",
+ footer: "Kaneo-Benachrichtigung",
+ actionLabel: "In Kaneo oeffnen",
+ },
+} as const;
+
+const NotificationEmail = ({
+ title,
+ message,
+ actionUrl,
+ actionLabel,
+ locale,
+}: NotificationEmailProps) => {
+ const copy = messages[resolveEmailLocale(locale)];
+
+ return (
+ <EmailShell preview={copy.preview} title={title} subtitle={copy.subtitle}>
+ <Section>
+ <Text style={styles.paragraph}>{message}</Text>
+ {actionUrl ? (
+ <Link style={styles.button} href={actionUrl}>
+ {actionLabel ?? copy.actionLabel}
+ </Link>
+ ) : null}
+ <Section style={styles.divider} />
+ <Text style={styles.footer}>{copy.footer}</Text>
+ </Section>
+ </EmailShell>
+ );
+};
+
+NotificationEmail.PreviewProps = {
+ title: "Task assigned to you",
+ message: "You were assigned to Design account notifications.",
+ actionUrl: "https://kaneo.app",
+} as NotificationEmailProps;
+
+export default NotificationEmail;