⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(notification): implement notification system (#270)
Andrej3907fb23042e
diff --git a/apps/api/drizzle/0005_faulty_xorn.sql b/apps/api/drizzle/0005_faulty_xorn.sqlnew file mode 100644index 000000000..270b3ec92--- /dev/null+++ b/apps/api/drizzle/0005_faulty_xorn.sql@@ -0,0 +1,127 @@+CREATE TABLE `notification` (+ `id` text PRIMARY KEY NOT NULL,+ `user_email` text NOT NULL,+ `title` text NOT NULL,+ `content` text,+ `type` text DEFAULT 'info' NOT NULL,+ `is_read` integer DEFAULT false,+ `resource_id` text,+ `resource_type` text,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ FOREIGN KEY (`user_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+PRAGMA foreign_keys=OFF;--> statement-breakpoint+CREATE TABLE `__new_activity` (+ `id` text PRIMARY KEY NOT NULL,+ `task_id` text NOT NULL,+ `type` text NOT NULL,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ `user_email` text NOT NULL,+ `content` text,+ FOREIGN KEY (`task_id`) REFERENCES `task`(`id`) ON UPDATE cascade ON DELETE cascade,+ FOREIGN KEY (`user_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_activity`("id", "task_id", "type", "created_at", "user_email", "content") SELECT "id", "task_id", "type", "created_at", "user_email", "content" FROM `activity`;--> statement-breakpoint+DROP TABLE `activity`;--> statement-breakpoint+ALTER TABLE `__new_activity` RENAME TO `activity`;--> statement-breakpoint+PRAGMA foreign_keys=ON;--> statement-breakpoint+CREATE TABLE `__new_label` (+ `id` text PRIMARY KEY NOT NULL,+ `name` text NOT NULL,+ `color` text NOT NULL,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ `task_id` text NOT NULL,+ FOREIGN KEY (`task_id`) REFERENCES `task`(`id`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_label`("id", "name", "color", "created_at", "task_id") SELECT "id", "name", "color", "created_at", "task_id" FROM `label`;--> statement-breakpoint+DROP TABLE `label`;--> statement-breakpoint+ALTER TABLE `__new_label` RENAME TO `label`;--> statement-breakpoint+CREATE TABLE `__new_project` (+ `id` text PRIMARY KEY NOT NULL,+ `workspace_id` text NOT NULL,+ `slug` text NOT NULL,+ `icon` text DEFAULT 'Layout',+ `name` text NOT NULL,+ `description` text,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_project`("id", "workspace_id", "slug", "icon", "name", "description", "created_at") SELECT "id", "workspace_id", "slug", "icon", "name", "description", "created_at" FROM `project`;--> statement-breakpoint+DROP TABLE `project`;--> statement-breakpoint+ALTER TABLE `__new_project` RENAME TO `project`;--> statement-breakpoint+CREATE TABLE `__new_task` (+ `id` text PRIMARY KEY NOT NULL,+ `project_id` text NOT NULL,+ `position` integer DEFAULT 0,+ `number` integer DEFAULT 1,+ `assignee_email` text,+ `title` text NOT NULL,+ `description` text,+ `status` text DEFAULT 'to-do' NOT NULL,+ `priority` text DEFAULT 'low',+ `due_date` integer,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE cascade ON DELETE cascade,+ FOREIGN KEY (`assignee_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_task`("id", "project_id", "position", "number", "assignee_email", "title", "description", "status", "priority", "due_date", "created_at") SELECT "id", "project_id", "position", "number", "assignee_email", "title", "description", "status", "priority", "due_date", "created_at" FROM `task`;--> statement-breakpoint+DROP TABLE `task`;--> statement-breakpoint+ALTER TABLE `__new_task` RENAME TO `task`;--> statement-breakpoint+CREATE TABLE `__new_time_entry` (+ `id` text PRIMARY KEY NOT NULL,+ `task_id` text NOT NULL,+ `user_email` text,+ `description` text,+ `start_time` integer NOT NULL,+ `end_time` integer,+ `duration` integer DEFAULT 0,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ FOREIGN KEY (`task_id`) REFERENCES `task`(`id`) ON UPDATE cascade ON DELETE cascade,+ FOREIGN KEY (`user_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_time_entry`("id", "task_id", "user_email", "description", "start_time", "end_time", "duration", "created_at") SELECT "id", "task_id", "user_email", "description", "start_time", "end_time", "duration", "created_at" FROM `time_entry`;--> statement-breakpoint+DROP TABLE `time_entry`;--> statement-breakpoint+ALTER TABLE `__new_time_entry` RENAME TO `time_entry`;--> statement-breakpoint+CREATE TABLE `__new_user` (+ `id` text PRIMARY KEY NOT NULL,+ `name` text NOT NULL,+ `password` text NOT NULL,+ `email` text NOT NULL,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.143Z"' NOT NULL+);+--> statement-breakpoint+INSERT INTO `__new_user`("id", "name", "password", "email", "created_at") SELECT "id", "name", "password", "email", "created_at" FROM `user`;--> statement-breakpoint+DROP TABLE `user`;--> statement-breakpoint+ALTER TABLE `__new_user` RENAME TO `user`;--> statement-breakpoint+CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint+CREATE TABLE `__new_workspace` (+ `id` text PRIMARY KEY NOT NULL,+ `name` text NOT NULL,+ `description` text,+ `owner_email` text NOT NULL,+ `created_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ FOREIGN KEY (`owner_email`) REFERENCES `user`(`email`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_workspace`("id", "name", "description", "owner_email", "created_at") SELECT "id", "name", "description", "owner_email", "created_at" FROM `workspace`;--> statement-breakpoint+DROP TABLE `workspace`;--> statement-breakpoint+ALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint+CREATE TABLE `__new_workspace_member` (+ `id` text PRIMARY KEY NOT NULL,+ `workspace_id` text NOT NULL,+ `user_email` text,+ `role` text DEFAULT 'member' NOT NULL,+ `joined_at` integer DEFAULT '"2025-05-05T17:08:25.144Z"' NOT NULL,+ `status` text DEFAULT 'pending' NOT NULL,+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade+);+--> statement-breakpoint+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_email", "role", "joined_at", "status") SELECT "id", "workspace_id", "user_email", "role", "joined_at", "status" FROM `workspace_member`;--> statement-breakpoint+DROP TABLE `workspace_member`;--> statement-breakpoint+ALTER TABLE `__new_workspace_member` RENAME TO `workspace_member`;\ No newline at end of filediff --git a/apps/api/drizzle/meta/0005_snapshot.json b/apps/api/drizzle/meta/0005_snapshot.jsonnew file mode 100644index 000000000..15fa51f70--- /dev/null+++ b/apps/api/drizzle/meta/0005_snapshot.json@@ -0,0 +1,715 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "1eebb9a6-9ef0-4b07-aaf1-11740ab0b6cc",+ "prevId": "7e69d763-6d6f-49f5-893e-a168deac584f",+ "tables": {+ "activity": {+ "name": "activity",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ },+ "user_email": {+ "name": "user_email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": 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_email_user_email_fk": {+ "name": "activity_user_email_user_email_fk",+ "tableFrom": "activity",+ "tableTo": "user",+ "columnsFrom": ["user_email"],+ "columnsTo": ["email"],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "label": {+ "name": "label",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": 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"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "notification": {+ "name": "notification",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "user_email": {+ "name": "user_email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "content": {+ "name": "content",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'info'"+ },+ "is_read": {+ "name": "is_read",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "resource_id": {+ "name": "resource_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resource_type": {+ "name": "resource_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notification_user_email_user_email_fk": {+ "name": "notification_user_email_user_email_fk",+ "tableFrom": "notification",+ "tableTo": "user",+ "columnsFrom": ["user_email"],+ "columnsTo": ["email"],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "project": {+ "name": "project",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "icon": {+ "name": "icon",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'Layout'"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ }+ },+ "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": {},+ "checkConstraints": {}+ },+ "session": {+ "name": "session",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "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": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "task": {+ "name": "task",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "project_id": {+ "name": "project_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "position": {+ "name": "position",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 0+ },+ "number": {+ "name": "number",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 1+ },+ "assignee_email": {+ "name": "assignee_email",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'to-do'"+ },+ "priority": {+ "name": "priority",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'low'"+ },+ "due_date": {+ "name": "due_date",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ }+ },+ "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_email_user_email_fk": {+ "name": "task_assignee_email_user_email_fk",+ "tableFrom": "task",+ "tableTo": "user",+ "columnsFrom": ["assignee_email"],+ "columnsTo": ["email"],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "time_entry": {+ "name": "time_entry",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "task_id": {+ "name": "task_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_email": {+ "name": "user_email",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "start_time": {+ "name": "start_time",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "end_time": {+ "name": "end_time",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "duration": {+ "name": "duration",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 0+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ }+ },+ "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_email_user_email_fk": {+ "name": "time_entry_user_email_user_email_fk",+ "tableFrom": "time_entry",+ "tableTo": "user",+ "columnsFrom": ["user_email"],+ "columnsTo": ["email"],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user": {+ "name": "user",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.143Z\"'"+ }+ },+ "indexes": {+ "user_email_unique": {+ "name": "user_email_unique",+ "columns": ["email"],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "workspace": {+ "name": "workspace",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "owner_email": {+ "name": "owner_email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "workspace_owner_email_user_email_fk": {+ "name": "workspace_owner_email_user_email_fk",+ "tableFrom": "workspace",+ "tableTo": "user",+ "columnsFrom": ["owner_email"],+ "columnsTo": ["email"],+ "onDelete": "cascade",+ "onUpdate": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "workspace_member": {+ "name": "workspace_member",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "user_email": {+ "name": "user_email",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "joined_at": {+ "name": "joined_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'\"2025-05-05T17:08:25.144Z\"'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'pending'"+ }+ },+ "indexes": {},+ "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": "cascade"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.jsonindex d6b7fdf74..a0bbb91f8 100644--- a/apps/api/drizzle/meta/_journal.json+++ b/apps/api/drizzle/meta/_journal.json@@ -36,6 +36,13 @@"when": 1746066911796,"tag": "0004_small_dragon_lord","breakpoints": true+ },+ {+ "idx": 5,+ "version": "6",+ "when": 1746464905156,+ "tag": "0005_faulty_xorn",+ "breakpoints": true}]}diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.tsindex 71b918807..0b4a9dacd 100644--- a/apps/api/src/database/schema.ts+++ b/apps/api/src/database/schema.ts@@ -168,3 +168,24 @@ export const labelTable = sqliteTable("label", {onUpdate: "cascade",}),});++export const notificationTable = sqliteTable("notification", {+ id: text("id")+ .$defaultFn(() => createId())+ .primaryKey(),+ userEmail: text("user_email")+ .notNull()+ .references(() => userTable.email, {+ onDelete: "cascade",+ onUpdate: "cascade",+ }),+ title: text("title").notNull(),+ content: text("content"),+ type: text("type").notNull().default("info"),+ isRead: integer("is_read", { mode: "boolean" }).default(false),+ resourceId: text("resource_id"),+ resourceType: text("resource_type"),+ createdAt: integer("created_at", { mode: "timestamp" })+ .default(new Date())+ .notNull(),+});diff --git a/apps/api/src/index.ts b/apps/api/src/index.tsindex fe0ed9963..b50243bea 100644--- a/apps/api/src/index.ts+++ b/apps/api/src/index.ts@@ -7,6 +7,7 @@ import activity from "./activity";import db from "./database";import label from "./label";import { auth } from "./middlewares/auth";+import notification from "./notification";import project from "./project";import task from "./task";import timeEntry from "./time-entry";@@ -77,6 +78,7 @@ const taskRoute = app.route("/task", task);const activityRoute = app.route("/activity", activity);const timeEntryRoute = app.route("/time-entry", timeEntry);const labelRoute = app.route("/label", label);+const notificationRoute = app.route("/notification", notification);try {console.log("Migrating database...");@@ -106,4 +108,5 @@ export type AppType =| typeof activityRoute| typeof meRoute| typeof timeEntryRoute- | typeof labelRoute;+ | typeof labelRoute+ | typeof notificationRoute;diff --git a/apps/api/src/notification/controllers/clear-notifications.ts b/apps/api/src/notification/controllers/clear-notifications.tsnew file mode 100644index 000000000..681034a12--- /dev/null+++ b/apps/api/src/notification/controllers/clear-notifications.ts@@ -0,0 +1,13 @@+import { eq } from "drizzle-orm";+import db from "../../database";+import { notificationTable } from "../../database/schema";++async function clearNotifications(userEmail: string) {+ await db+ .delete(notificationTable)+ .where(eq(notificationTable.userEmail, userEmail));++ return { success: true };+}++export default clearNotifications;diff --git a/apps/api/src/notification/controllers/create-notification.ts b/apps/api/src/notification/controllers/create-notification.tsnew file mode 100644index 000000000..afef2f198--- /dev/null+++ b/apps/api/src/notification/controllers/create-notification.ts@@ -0,0 +1,44 @@+import { createId } from "@paralleldrive/cuid2";+import db from "../../database";+import { notificationTable } from "../../database/schema";+import { publishEvent } from "../../events";++async function createNotification({+ userEmail,+ title,+ content,+ type,+ resourceId,+ resourceType,+}: {+ userEmail: string;+ title: string;+ content?: string;+ type?: string;+ resourceId?: string;+ resourceType?: string;+}) {+ const [notification] = await db+ .insert(notificationTable)+ .values({+ id: createId(),+ userEmail,+ title,+ content: content || "",+ type: type || "info",+ resourceId: resourceId || null,+ resourceType: resourceType || null,+ })+ .returning();++ if (notification) {+ await publishEvent("notification.created", {+ notificationId: notification.id,+ userEmail,+ });+ }++ return notification;+}++export default createNotification;diff --git a/apps/api/src/notification/controllers/get-notifications.ts b/apps/api/src/notification/controllers/get-notifications.tsnew file mode 100644index 000000000..8cf98dcda--- /dev/null+++ b/apps/api/src/notification/controllers/get-notifications.ts@@ -0,0 +1,16 @@+import { desc, eq } from "drizzle-orm";+import db from "../../database";+import { notificationTable } from "../../database/schema";++async function getNotifications(userEmail: string) {+ const notifications = await db+ .select()+ .from(notificationTable)+ .where(eq(notificationTable.userEmail, userEmail))+ .orderBy(desc(notificationTable.createdAt))+ .limit(50);++ return notifications;+}++export default getNotifications;diff --git a/apps/api/src/notification/controllers/mark-all-notifications-as-read.ts b/apps/api/src/notification/controllers/mark-all-notifications-as-read.tsnew file mode 100644index 000000000..b6666cffa--- /dev/null+++ b/apps/api/src/notification/controllers/mark-all-notifications-as-read.ts@@ -0,0 +1,14 @@+import { eq } from "drizzle-orm";+import db from "../../database";+import { notificationTable } from "../../database/schema";++async function markAllNotificationsAsRead(userEmail: string) {+ await db+ .update(notificationTable)+ .set({ isRead: true })+ .where(eq(notificationTable.userEmail, userEmail));++ return { success: true };+}++export default markAllNotificationsAsRead;diff --git a/apps/api/src/notification/controllers/mark-notification-as-read.ts b/apps/api/src/notification/controllers/mark-notification-as-read.tsnew file mode 100644index 000000000..1cc59f974--- /dev/null+++ b/apps/api/src/notification/controllers/mark-notification-as-read.ts@@ -0,0 +1,22 @@+import { eq } from "drizzle-orm";+import { HTTPException } from "hono/http-exception";+import db from "../../database";+import { notificationTable } from "../../database/schema";++async function markNotificationAsRead(id: string) {+ const [notification] = await db+ .update(notificationTable)+ .set({ isRead: true })+ .where(eq(notificationTable.id, id))+ .returning();++ if (!notification) {+ throw new HTTPException(404, {+ message: "Notification not found",+ });+ }++ return notification;+}++export default markNotificationAsRead;diff --git a/apps/api/src/notification/index.ts b/apps/api/src/notification/index.tsnew file mode 100644index 000000000..b118fa224--- /dev/null+++ b/apps/api/src/notification/index.ts@@ -0,0 +1,212 @@+import { zValidator } from "@hono/zod-validator";+import { eq } from "drizzle-orm";+import { Hono } from "hono";+import { z } from "zod";+import db from "../database";+import { taskTable } from "../database/schema";+import { subscribeToEvent } from "../events";+import clearNotifications from "./controllers/clear-notifications";+import createNotification from "./controllers/create-notification";+import getNotifications from "./controllers/get-notifications";+import markAllNotificationsAsRead from "./controllers/mark-all-notifications-as-read";+import markNotificationAsRead from "./controllers/mark-notification-as-read";++const notification = new Hono<{+ Variables: {+ userEmail: string;+ };+}>()+ .get("/", async (c) => {+ const userEmail = c.get("userEmail");+ const notifications = await getNotifications(userEmail);+ return c.json(notifications);+ })+ .post(+ "/",+ zValidator(+ "json",+ z.object({+ userEmail: z.string(),+ title: z.string(),+ content: z.string().optional(),+ type: z.string().optional(),+ resourceId: z.string().optional(),+ resourceType: z.string().optional(),+ }),+ ),+ async (c) => {+ const { userEmail, title, content, type, resourceId, resourceType } =+ c.req.valid("json");++ const notification = await createNotification({+ userEmail,+ title,+ content,+ type,+ resourceId,+ resourceType,+ });++ return c.json(notification);+ },+ )+ .patch(+ "/:id/read",+ zValidator("param", z.object({ id: z.string() })),+ async (c) => {+ const { id } = c.req.valid("param");+ const notification = await markNotificationAsRead(id);+ return c.json(notification);+ },+ )+ .patch("/read-all", async (c) => {+ const userEmail = c.get("userEmail");+ const result = await markAllNotificationsAsRead(userEmail);+ return c.json(result);+ })+ .delete("/clear-all", async (c) => {+ const userEmail = c.get("userEmail");+ const result = await clearNotifications(userEmail);+ return c.json(result);+ });++subscribeToEvent(+ "task.created",+ async ({+ taskId,+ userEmail,+ title,+ }: {+ taskId: string;+ userEmail: string;+ title?: string;+ type: string;+ content: string;+ }) => {+ if (!userEmail || !taskId) {+ return;+ }++ await createNotification({+ userEmail,+ title: "New Task Created",+ content: title ? `Task "${title}" was created` : "A new task was created",+ type: "task",+ resourceId: taskId,+ resourceType: "task",+ });+ },+);++subscribeToEvent(+ "workspace.created",+ async ({+ workspaceId,+ ownerEmail,+ }: { workspaceId: string; ownerEmail: string }) => {+ if (!workspaceId || !ownerEmail) {+ return;+ }++ await createNotification({+ userEmail: ownerEmail,+ title: "Workspace Created",+ content: "Your new workspace is ready",+ type: "workspace",+ resourceId: workspaceId,+ resourceType: "workspace",+ });+ },+);++subscribeToEvent(+ "task.status_changed",+ async ({+ taskId,+ userEmail,+ oldStatus,+ newStatus,+ title,+ }: {+ taskId: string;+ userEmail: string | null;+ oldStatus: string;+ newStatus: string;+ title: string;+ }) => {+ if (!taskId || !userEmail) {+ return;+ }++ await createNotification({+ userEmail,+ title: "Task Status Updated",+ content: `Task "${title}" moved from ${oldStatus.replace(/-/g, " ")} to ${newStatus.replace(/-/g, " ")}`,+ type: "task",+ resourceId: taskId,+ resourceType: "task",+ });+ },+);++subscribeToEvent(+ "task.assignee_changed",+ async ({+ taskId,+ newAssignee,+ title,+ }: {+ taskId: string;+ newAssignee: string | null;+ title: string;+ }) => {+ if (!taskId || !newAssignee) {+ return;+ }++ await createNotification({+ userEmail: newAssignee,+ title: "Task Assigned to You",+ content: `You have been assigned to task "${title}"`,+ type: "task",+ resourceId: taskId,+ resourceType: "task",+ });+ },+);++subscribeToEvent(+ "time-entry.created",+ async ({+ timeEntryId,+ taskId,+ userEmail,+ }: {+ timeEntryId: string;+ taskId: string;+ userEmail: string;+ type: string;+ content: string;+ }) => {+ if (!timeEntryId || !taskId || !userEmail) {+ return;+ }++ const task = await db.query.taskTable.findFirst({+ where: eq(taskTable.id, taskId),+ });++ if (task) {+ await createNotification({+ userEmail,+ title: "Time Tracking Started",+ content: `You started tracking time for task "${task.title}"`,+ type: "time-entry",+ resourceId: taskId,+ resourceType: "task",+ });+ }+ },+);++export default notification;diff --git a/apps/api/src/task/controllers/update-task.ts b/apps/api/src/task/controllers/update-task.tsindex dbdc06101..b92b1bb88 100644--- a/apps/api/src/task/controllers/update-task.ts+++ b/apps/api/src/task/controllers/update-task.ts@@ -2,48 +2,68 @@ import { eq } from "drizzle-orm";import { HTTPException } from "hono/http-exception";import db from "../../database";import { taskTable } from "../../database/schema";+import { publishEvent } from "../../events";async function updateTask(- taskId: string,+ id: string,title: string,status: string,dueDate: Date,projectId: string,- description?: string,- priority?: string,- position?: number,+ description: string,+ priority: string,+ position: number,userEmail?: string,) {- const [existingTask] = await db- .select()- .from(taskTable)- .where(eq(taskTable.id, taskId));+ const existingTask = await db.query.taskTable.findFirst({+ where: eq(taskTable.id, id),+ });- const isTaskExisting = Boolean(existingTask);-- if (!isTaskExisting) {+ if (!existingTask) {throw new HTTPException(404, {- message: "Task doesn't exist",+ message: "Task not found",});}- const userEmailToUpdate = userEmail?.length ? userEmail : null;-const [updatedTask] = await db.update(taskTable).set({title,- description,status,dueDate,+ projectId,+ description,priority,- userEmail: userEmailToUpdate,position,- projectId,+ userEmail: userEmail || null,})- .where(eq(taskTable.id, taskId))+ .where(eq(taskTable.id, id)).returning();+ if (!updatedTask) {+ throw new HTTPException(500, {+ message: "Failed to update task",+ });+ }++ if (existingTask.status !== status) {+ await publishEvent("task.status_changed", {+ taskId: updatedTask.id,+ userEmail: updatedTask.userEmail,+ oldStatus: existingTask.status,+ newStatus: status,+ title: updatedTask.title,+ });+ }++ if (existingTask.userEmail !== userEmail) {+ await publishEvent("task.assignee_changed", {+ taskId: updatedTask.id,+ newAssignee: userEmail,+ title: updatedTask.title,+ });+ }+return updatedTask;}diff --git a/apps/web/src/components/common/sidebar/sidebar-header.tsx b/apps/web/src/components/common/sidebar/sidebar-header.tsxindex 0f8fa26aa..0f7fdafb7 100644--- a/apps/web/src/components/common/sidebar/sidebar-header.tsx+++ b/apps/web/src/components/common/sidebar/sidebar-header.tsx@@ -6,7 +6,7 @@ export function SidebarHeader() {const { isSidebarOpened, setIsSidebarOpened } = useUserPreferencesStore();return (- <div className="p-4 border-b border-zinc-200 dark:border-zinc-800 flex items-center justify-between">+ <div className="p-4 flex items-center justify-between">{isSidebarOpened && <Logo />}<buttondiff --git a/apps/web/src/components/kanban-board/task-card.tsx b/apps/web/src/components/kanban-board/task-card.tsxindex ff1ad8bdb..0cfbabb45 100644--- a/apps/web/src/components/kanban-board/task-card.tsx+++ b/apps/web/src/components/kanban-board/task-card.tsx@@ -49,6 +49,8 @@ function TaskCard({ task }: TaskCardProps) {});}+ console.log(task);+return (<div ref={setNodeRef} style={style} {...attributes} {...listeners}><ContextMenu>diff --git a/apps/web/src/components/notification/notification-bell.tsx b/apps/web/src/components/notification/notification-bell.tsxnew file mode 100644index 000000000..b68db48a0--- /dev/null+++ b/apps/web/src/components/notification/notification-bell.tsx@@ -0,0 +1,156 @@+import { Button } from "@/components/ui/button";+import useClearNotifications from "@/hooks/mutations/notification/use-clear-notifications";+import useMarkAllNotificationsAsRead from "@/hooks/mutations/notification/use-mark-all-notifications-as-read";+import useGetNotifications from "@/hooks/queries/notification/use-get-notifications";+import { cn } from "@/lib/cn";+import * as Popover from "@radix-ui/react-popover";+import { AnimatePresence, motion } from "framer-motion";+import { Bell, CheckCheck, Trash2 } from "lucide-react";+import { useState } from "react";+import { toast } from "sonner";+import NotificationItem from "./notification-item";++export default function NotificationBell() {+ const [isOpen, setIsOpen] = useState(false);+ const { data: notifications = [], isLoading } = useGetNotifications();+ const { mutate: markAllAsRead } = useMarkAllNotificationsAsRead();+ const { mutate: clearAllNotifications } = useClearNotifications();++ const unreadCount = notifications?.filter(+ (notification) => notification.isRead === false,+ ).length;++ const handleMarkAllAsRead = () => {+ markAllAsRead(undefined, {+ onSuccess: () => {+ toast.success("All notifications marked as read");+ },+ onError: (error) => {+ toast.error(+ error instanceof Error+ ? error.message+ : "Failed to mark notifications as read",+ );+ },+ });+ };++ const handleClearAllNotifications = () => {+ clearAllNotifications(undefined, {+ onSuccess: () => {+ toast.success("All notifications cleared");+ },+ onError: (error) => {+ toast.error(+ error instanceof Error+ ? error.message+ : "Failed to clear notifications",+ );+ },+ });+ };++ return (+ <Popover.Root open={isOpen} onOpenChange={setIsOpen}>+ <Popover.Trigger asChild>+ <Button+ variant="ghost"+ size="icon"+ className="relative h-8 w-8 rounded-full"+ >+ <Bell className="h-4 w-4 text-zinc-700 dark:text-zinc-300" />+ {unreadCount > 0 && (+ <span className="absolute -top-0.5 -right-0.5 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-red-500 text-[8px] font-medium text-white">+ {unreadCount > 9 ? "9+" : unreadCount}+ </span>+ )}+ </Button>+ </Popover.Trigger>+ <Popover.Portal>+ <Popover.Content+ align="end"+ sideOffset={8}+ className="z-50 w-80 rounded-lg border border-zinc-200 bg-white p-0 shadow-lg dark:border-zinc-800 dark:bg-zinc-900"+ >+ <AnimatePresence>+ <motion.div+ initial={{ opacity: 0, y: -10 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -10 }}+ transition={{ duration: 0.2 }}+ >+ <div className="flex items-center justify-between border-b border-zinc-200 p-3 dark:border-zinc-800">+ <h3 className="text-sm font-medium text-zinc-900 dark:text-zinc-100">+ Notifications+ </h3>+ <div className="flex gap-2">+ {notifications.length > 0 && (+ <>+ <Button+ variant="ghost"+ size="sm"+ className="h-8 gap-1 text-xs text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"+ onClick={handleClearAllNotifications}+ >+ <Trash2 className="h-3.5 w-3.5" />+ Clear all+ </Button>+ {unreadCount > 0 && (+ <Button+ variant="ghost"+ size="sm"+ className="h-8 gap-1 text-xs text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100"+ onClick={handleMarkAllAsRead}+ >+ <CheckCheck className="h-3.5 w-3.5" />+ Mark read+ </Button>+ )}+ </>+ )}+ </div>+ </div>++ <div+ className={cn(+ "max-h-[350px] overflow-y-auto scrollbar-thin scrollbar-thumb-zinc-300 dark:scrollbar-thumb-zinc-700",+ notifications.length === 0 && "overflow-hidden",+ )}+ >+ {isLoading ? (+ <div className="flex h-20 items-center justify-center">+ <div className="h-5 w-5 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />+ </div>+ ) : notifications.length === 0 ? (+ <div className="flex flex-col items-center justify-center py-8 text-center">+ <div className="mb-3 rounded-full bg-zinc-100 p-3 dark:bg-zinc-800">+ <Bell className="h-5 w-5 text-zinc-500 dark:text-zinc-400" />+ </div>+ <p className="mb-1 text-sm font-medium text-zinc-900 dark:text-zinc-100">+ No notifications+ </p>+ <p className="text-xs text-zinc-500 dark:text-zinc-400">+ You're all caught up!+ </p>+ </div>+ ) : (+ <div className="divide-y divide-zinc-200 dark:divide-zinc-800">+ {notifications &&+ notifications.length > 0 &&+ notifications.map((notification) => (+ <NotificationItem+ key={notification.id}+ notification={notification}+ onClose={() => setIsOpen(false)}+ />+ ))}+ </div>+ )}+ </div>+ </motion.div>+ </AnimatePresence>+ </Popover.Content>+ </Popover.Portal>+ </Popover.Root>+ );+}diff --git a/apps/web/src/components/notification/notification-item.tsx b/apps/web/src/components/notification/notification-item.tsxnew file mode 100644index 000000000..60c751bce--- /dev/null+++ b/apps/web/src/components/notification/notification-item.tsx@@ -0,0 +1,124 @@+import useMarkNotificationAsRead from "@/hooks/mutations/notification/use-mark-notification-as-read";+import { cn } from "@/lib/cn";+import type { Notification } from "@/types/notification";+import { useNavigate } from "@tanstack/react-router";+import { formatDistanceToNow } from "date-fns";+import {+ AlertCircle,+ CheckCircle2,+ FileText,+ FolderKanban,+ Info,+ MessageSquare,+ Users,+} from "lucide-react";++interface NotificationItemProps {+ notification: Notification;+ onClose?: () => void;+}++export default function NotificationItem({+ notification,+ onClose,+}: NotificationItemProps) {+ const navigate = useNavigate();+ const { mutate: markAsRead } = useMarkNotificationAsRead();++ const handleClick = () => {+ if (!notification.isRead) {+ markAsRead(notification.id);+ }++ if (notification.resourceId && notification.resourceType) {+ if (notification.resourceType === "task") {+ onClose?.();+ } else if (notification.resourceType === "workspace") {+ navigate({+ to: "/dashboard/workspace/$workspaceId",+ params: { workspaceId: notification.resourceId },+ });+ onClose?.();+ }+ }+ };++ const getIcon = () => {+ switch (notification.type) {+ case "task":+ return (+ <FileText className="h-4 w-4 text-blue-500 dark:text-blue-400" />+ );+ case "workspace":+ return (+ <FolderKanban className="h-4 w-4 text-purple-500 dark:text-purple-400" />+ );+ case "project":+ return <Users className="h-4 w-4 text-green-500 dark:text-green-400" />;+ case "comment":+ return (+ <MessageSquare className="h-4 w-4 text-yellow-500 dark:text-yellow-400" />+ );+ case "success":+ return (+ <CheckCircle2 className="h-4 w-4 text-green-500 dark:text-green-400" />+ );+ case "error":+ return (+ <AlertCircle className="h-4 w-4 text-red-500 dark:text-red-400" />+ );+ case "warning":+ return (+ <AlertCircle className="h-4 w-4 text-yellow-500 dark:text-yellow-400" />+ );+ default:+ return <Info className="h-4 w-4 text-blue-500 dark:text-blue-400" />;+ }+ };++ return (+ <div+ className={cn(+ "flex cursor-pointer gap-3 p-3 hover:bg-zinc-50 dark:hover:bg-zinc-800/50",+ !notification.isRead && "bg-blue-50/50 dark:bg-blue-900/10",+ )}+ onClick={handleClick}+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") {+ handleClick();+ }+ }}+ >+ <div+ className={cn(+ "mt-0.5 flex h-8 w-8 items-center justify-center rounded-full bg-zinc-100 dark:bg-zinc-800",+ !notification.isRead && "bg-blue-100 dark:bg-blue-900/20",+ )}+ >+ {getIcon()}+ </div>+ <div className="flex-1 space-y-1">+ <div className="flex items-start justify-between">+ <p+ className={cn(+ "text-sm text-zinc-900 dark:text-zinc-100",+ !notification.isRead && "font-medium",+ )}+ >+ {notification.title}+ </p>+ <span className="ml-2 whitespace-nowrap text-xs text-zinc-500 dark:text-zinc-400">+ {formatDistanceToNow(new Date(notification.createdAt), {+ addSuffix: true,+ })}+ </span>+ </div>+ {notification.content && (+ <p className="text-xs text-zinc-500 dark:text-zinc-400">+ {notification.content}+ </p>+ )}+ </div>+ </div>+ );+}diff --git a/apps/web/src/fetchers/notification/clear-notifications.ts b/apps/web/src/fetchers/notification/clear-notifications.tsnew file mode 100644index 000000000..1b5ba29fa--- /dev/null+++ b/apps/web/src/fetchers/notification/clear-notifications.ts@@ -0,0 +1,15 @@+import { client } from "@kaneo/libs";++async function clearNotifications() {+ const response = await client.notification["clear-all"].$delete();++ if (!response.ok) {+ const error = await response.text();+ throw new Error(error);+ }++ const data = await response.json();+ return data;+}++export default clearNotifications;diff --git a/apps/web/src/fetchers/notification/get-notifications.ts b/apps/web/src/fetchers/notification/get-notifications.tsnew file mode 100644index 000000000..f0a0c953d--- /dev/null+++ b/apps/web/src/fetchers/notification/get-notifications.ts@@ -0,0 +1,15 @@+import { client } from "@kaneo/libs";++async function getNotifications() {+ const response = await client.notification.$get();++ if (!response.ok) {+ const error = await response.text();+ throw new Error(error);+ }++ const data = await response.json();+ return data;+}++export default getNotifications;diff --git a/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts b/apps/web/src/fetchers/notification/mark-all-notifications-as-read.tsnew file mode 100644index 000000000..5f8126f35--- /dev/null+++ b/apps/web/src/fetchers/notification/mark-all-notifications-as-read.ts@@ -0,0 +1,15 @@+import { client } from "@kaneo/libs";++async function markAllNotificationsAsRead() {+ const response = await client.notification["read-all"].$patch();++ if (!response.ok) {+ const error = await response.text();+ throw new Error(error);+ }++ const data = await response.json();+ return data;+}++export default markAllNotificationsAsRead;diff --git a/apps/web/src/fetchers/notification/mark-notification-as-read.ts b/apps/web/src/fetchers/notification/mark-notification-as-read.tsnew file mode 100644index 000000000..31a7b3270--- /dev/null+++ b/apps/web/src/fetchers/notification/mark-notification-as-read.ts@@ -0,0 +1,17 @@+import { client } from "@kaneo/libs";++async function markNotificationAsRead(id: string) {+ const response = await client.notification[":id"].read.$patch({+ param: { id },+ });++ if (!response.ok) {+ const error = await response.text();+ throw new Error(error);+ }++ const data = await response.json();+ return data;+}++export default markNotificationAsRead;diff --git a/apps/web/src/hooks/mutations/notification/use-clear-notifications.ts b/apps/web/src/hooks/mutations/notification/use-clear-notifications.tsnew file mode 100644index 000000000..a1c55c375--- /dev/null+++ b/apps/web/src/hooks/mutations/notification/use-clear-notifications.ts@@ -0,0 +1,15 @@+import clearNotifications from "@/fetchers/notification/clear-notifications";+import { useMutation, useQueryClient } from "@tanstack/react-query";++function useClearNotifications() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: clearNotifications,+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["notifications"] });+ },+ });+}++export default useClearNotifications;diff --git a/apps/web/src/hooks/mutations/notification/use-mark-all-notifications-as-read.ts b/apps/web/src/hooks/mutations/notification/use-mark-all-notifications-as-read.tsnew file mode 100644index 000000000..d93095dca--- /dev/null+++ b/apps/web/src/hooks/mutations/notification/use-mark-all-notifications-as-read.ts@@ -0,0 +1,15 @@+import markAllNotificationsAsRead from "@/fetchers/notification/mark-all-notifications-as-read";+import { useMutation, useQueryClient } from "@tanstack/react-query";++function useMarkAllNotificationsAsRead() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: markAllNotificationsAsRead,+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["notifications"] });+ },+ });+}++export default useMarkAllNotificationsAsRead;diff --git a/apps/web/src/hooks/mutations/notification/use-mark-notification-as-read.ts b/apps/web/src/hooks/mutations/notification/use-mark-notification-as-read.tsnew file mode 100644index 000000000..c063cb55c--- /dev/null+++ b/apps/web/src/hooks/mutations/notification/use-mark-notification-as-read.ts@@ -0,0 +1,15 @@+import markNotificationAsRead from "@/fetchers/notification/mark-notification-as-read";+import { useMutation, useQueryClient } from "@tanstack/react-query";++function useMarkNotificationAsRead() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: (id: string) => markNotificationAsRead(id),+ onSuccess: () => {+ queryClient.invalidateQueries({ queryKey: ["notifications"] });+ },+ });+}++export default useMarkNotificationAsRead;diff --git a/apps/web/src/hooks/mutations/task/use-update-task.ts b/apps/web/src/hooks/mutations/task/use-update-task.tsindex 47a78241b..b6819490d 100644--- a/apps/web/src/hooks/mutations/task/use-update-task.ts+++ b/apps/web/src/hooks/mutations/task/use-update-task.ts@@ -14,6 +14,9 @@ function useUpdateTask() {queryClient.refetchQueries({queryKey: ["tasks", variables.projectId],});+ queryClient.refetchQueries({+ queryKey: ["notifications"],+ });},});}diff --git a/apps/web/src/hooks/queries/notification/use-get-notifications.ts b/apps/web/src/hooks/queries/notification/use-get-notifications.tsnew file mode 100644index 000000000..5c8a22566--- /dev/null+++ b/apps/web/src/hooks/queries/notification/use-get-notifications.ts@@ -0,0 +1,11 @@+import getNotifications from "@/fetchers/notification/get-notifications";+import { useQuery } from "@tanstack/react-query";++function useGetNotifications() {+ return useQuery({+ queryKey: ["notifications"],+ queryFn: getNotifications,+ });+}++export default useGetNotifications;diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsxindex cbe89c965..44a2ca9f1 100644--- a/apps/web/src/routes/__root.tsx+++ b/apps/web/src/routes/__root.tsx@@ -1,9 +1,7 @@import { CommandPalette } from "@/components/command-palette";import useTheme from "@/components/providers/theme-provider/hooks/use-theme";-import TanStackRouterDevtools from "@/tanstack/router";import type { LoggedInUser } from "@/types/user";import type { QueryClient } from "@tanstack/react-query";-import { ReactQueryDevtools } from "@tanstack/react-query-devtools";import {Outlet,createRootRouteWithContext,@@ -67,8 +65,6 @@ function RootComponent() {duration: 2000,}}/>- <ReactQueryDevtools buttonPosition="top-right" />- <TanStackRouterDevtools position="bottom-right" /></>);}diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsxindex 7a92f209d..1ef062fed 100644--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/project/$projectId/board.tsx@@ -1,15 +1,17 @@-import BoardFilters, {- type BoardFilters as BoardFiltersType,-} from "@/components/filters";+import type { BoardFilters as BoardFiltersType } from "@/components/filters";import KanbanBoard from "@/components/kanban-board";import ListView from "@/components/list-view";-import PageTitle from "@/components/page-title";+import NotificationBell from "@/components/notification/notification-bell";+import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";import useGetTasks from "@/hooks/queries/task/use-get-tasks";+import { cn } from "@/lib/cn";import useProjectStore from "@/store/project";import { useUserPreferencesStore } from "@/store/user-preferences";import type Task from "@/types/task";import { createFileRoute } from "@tanstack/react-router";import { addWeeks, endOfWeek, isWithinInterval, startOfWeek } from "date-fns";+import { Filter, LayoutGrid, List, Plus, Search, SortAsc } from "lucide-react";import { useEffect, useState } from "react";export const Route = createFileRoute(@@ -38,6 +40,13 @@ function RouteComponent() {}}, [data, setProject]);+ const handleSearchChange = (value: string) => {+ setFilters((prev) => ({+ ...prev,+ search: value,+ }));+ };+const filterTasks = (tasks: Task[]): Task[] => {let filteredTasks = tasks.filter((task) => {@@ -94,11 +103,9 @@ function RouteComponent() {}).map((task) => ({...task,- assigneeName: null,assigneeEmail: task.userEmail ?? null,}));- // Sort tasks if sort parameters are providedif (filters.sortBy && filters.sortOrder) {filteredTasks = filteredTasks.sort((a, b) => {const sortOrder = filters.sortOrder === "asc" ? 1 : -1;@@ -108,7 +115,6 @@ function RouteComponent() {return sortOrder * a.title.localeCompare(b.title);case "priority": {- // Custom priority order: urgent > high > medium > lowconst priorityOrder = { urgent: 0, high: 1, medium: 2, low: 3 };const aPriority = a.priority? (priorityOrder[a.priority as keyof typeof priorityOrder] ?? 999)@@ -120,7 +126,6 @@ function RouteComponent() {}case "dueDate": {- // Handle cases where dueDate might be undefinedif (!a.dueDate && !b.dueDate) return 0;if (!a.dueDate) return sortOrder;if (!b.dueDate) return -sortOrder;@@ -155,76 +160,134 @@ function RouteComponent() {tasks: filterTasks(column.tasks).map((task) => ({id: task.id,title: task.title,- number: task.number,- description: task.description,status: task.status,- priority: task.priority,dueDate: task.dueDate,+ priority: task.priority,position: task.position,createdAt: task.createdAt,userEmail: task.userEmail,- assigneeName: null,+ number: task.number,+ description: task.description ?? null,assigneeEmail: task.userEmail ?? null,projectId: task.projectId,+ assigneeName: task.userEmail ?? null,})),})) ?? [],- archivedTasks: filterTasks(project.archivedTasks).map((task) => ({- id: task.id,- title: task.title,- number: task.number,- description: task.description,- status: task.status,- priority: task.priority,- dueDate: task.dueDate,- position: task.position,- createdAt: task.createdAt,- userEmail: task.userEmail,- assigneeName: null,- assigneeEmail: task.userEmail ?? null,- projectId: task.projectId,- })),- plannedTasks: filterTasks(project.plannedTasks).map((task) => ({- id: task.id,- title: task.title,- number: task.number,- description: task.description,- status: task.status,- priority: task.priority,- dueDate: task.dueDate,- position: task.position,- createdAt: task.createdAt,- userEmail: task.userEmail,- assigneeName: null,- assigneeEmail: task.userEmail ?? null,- projectId: task.projectId,- })),}- : undefined;-- if (!filteredProject) {- return <div>No project found</div>;- }+ : null;return (- <div className="flex flex-col flex-1">- <PageTitle- title={`${project?.name || "Board"} · ${viewMode === "board" ? "Kanban" : "List"}`}- />- <div className="p-4 border-b border-zinc-200 dark:border-zinc-800 flex items-center justify-between flex-wrap gap-2">- <h1 className="text-lg font-medium text-zinc-900 dark:text-zinc-100">- {project?.name}- </h1>-- <div className="flex items-center">- <BoardFilters onFiltersChange={setFilters} />+ <div className="flex flex-col h-full">+ <div className="bg-white dark:bg-black border-b border-zinc-200 dark:border-zinc-800">+ <div className="h-14 flex items-center px-3">+ <div className="flex items-center justify-between w-full">+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="sm"+ className="h-7 px-2 text-xs text-zinc-700 dark:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"+ >+ <Plus className="h-3.5 w-3.5 mr-1.5" />+ New+ </Button>++ <div className="relative hidden sm:block">+ <Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400" />+ <Input+ value={filters.search}+ onChange={(e) => handleSearchChange(e.target.value)}+ placeholder="Search tasks..."+ className="h-7 w-[240px] pl-8 pr-3 text-xs bg-transparent border-zinc-200 dark:border-zinc-800"+ />+ </div>+ </div>++ <div className="flex items-center gap-2">+ <div className="flex items-center">+ <Button+ variant="ghost"+ size="sm"+ className={cn(+ "h-7 px-2 text-xs",+ filters.assignee || filters.priority || filters.dueDate+ ? "text-indigo-600 dark:text-indigo-400"+ : "text-zinc-600 dark:text-zinc-400",+ )}+ >+ <Filter className="h-3.5 w-3.5 mr-1.5" />+ <span className="hidden sm:inline">Filter</span>+ </Button>++ <Button+ variant="ghost"+ size="sm"+ className={cn(+ "h-7 px-2 text-xs",+ filters.sortBy+ ? "text-indigo-600 dark:text-indigo-400"+ : "text-zinc-600 dark:text-zinc-400",+ )}+ >+ <SortAsc className="h-3.5 w-3.5 mr-1.5" />+ <span className="hidden sm:inline">Sort</span>+ </Button>+ </div>++ <div className="border-l border-zinc-200 dark:border-zinc-800 h-4 mx-1 hidden sm:block" />++ <div className="flex items-center">+ <Button+ variant={viewMode === "board" ? "secondary" : "ghost"}+ size="sm"+ className="h-7 px-1.5"+ onClick={() => {+ useUserPreferencesStore.setState({ viewMode: "board" });+ }}+ >+ <LayoutGrid className="h-3.5 w-3.5" />+ </Button>++ <Button+ variant={viewMode === "list" ? "secondary" : "ghost"}+ size="sm"+ className="h-7 px-1.5"+ onClick={() => {+ useUserPreferencesStore.setState({ viewMode: "list" });+ }}+ >+ <List className="h-3.5 w-3.5" />+ </Button>+ </div>++ <NotificationBell />+ </div>+ </div>+ </div>++ <div className="sm:hidden px-3 py-2">+ <div className="relative">+ <Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400" />+ <Input+ value={filters.search}+ onChange={(e) => handleSearchChange(e.target.value)}+ placeholder="Search tasks..."+ className="h-8 w-full pl-8 pr-3 text-xs bg-transparent border-zinc-200 dark:border-zinc-800"+ />+ </div></div></div>- <div className="flex-1 overflow-auto">- {viewMode === "board" ? (- <KanbanBoard project={filteredProject} />+ <div className="flex-1 overflow-hidden bg-black/[0.03] dark:bg-black/30">+ {filteredProject ? (+ viewMode === "board" ? (+ <KanbanBoard project={filteredProject} />+ ) : (+ <ListView project={filteredProject} />+ )) : (- <ListView project={filteredProject} />+ <div className="flex h-full items-center justify-center">+ <div className="h-8 w-8 animate-spin rounded-full border-2 border-zinc-300 border-t-zinc-600 dark:border-zinc-700 dark:border-t-zinc-300" />+ </div>)}</div></div>diff --git a/apps/web/src/types/notification.ts b/apps/web/src/types/notification.tsnew file mode 100644index 000000000..0a678fafb--- /dev/null+++ b/apps/web/src/types/notification.ts@@ -0,0 +1,6 @@+import type { client } from "@kaneo/libs";+import type { InferResponseType } from "hono/client";++export type Notification = InferResponseType<+ (typeof client)["notification"]["$get"]+>[number];