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.

refactor: :recycle: adding workspace schemas, refactoring auth again...

Andrej43aa45ca85cf
diff --git a/apps/api/drizzle/0003_mature_madripoor.sql b/apps/api/drizzle/0003_mature_madripoor.sql
new file mode 100644
index 000000000..c4016f0af
--- /dev/null
+++ b/apps/api/drizzle/0003_mature_madripoor.sql
@@ -0,0 +1,55 @@
+CREATE TABLE `board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T21:49:54.348Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T21:49:54.348Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `workspace` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `owner_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:49:54.347Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+CREATE TABLE `workspace_member` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T21:49:54.347Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+PRAGMA foreign_keys=OFF;--> 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-01-05T21:49:54.347Z"' 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
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);
\ No newline at end of file
diff --git a/apps/api/drizzle/0004_quiet_vector.sql b/apps/api/drizzle/0004_quiet_vector.sql
new file mode 100644
index 000000000..ac134943e
--- /dev/null
+++ b/apps/api/drizzle/0004_quiet_vector.sql
@@ -0,0 +1,77 @@
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_session` (
+ `id` text PRIMARY KEY NOT NULL,
+ `user_id` text NOT NULL,
+ `expires_at` integer NOT NULL,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_session`("id", "user_id", "expires_at") SELECT "id", "user_id", "expires_at" FROM `session`;--> statement-breakpoint
+DROP TABLE `session`;--> statement-breakpoint
+ALTER TABLE `__new_session` RENAME TO `session`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE TABLE `__new_workspace` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `owner_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:16.320Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "created_at" FROM `workspace`;--> statement-breakpoint
+DROP TABLE `workspace`;--> statement-breakpoint
+ALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint
+CREATE TABLE `__new_board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:16.320Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+INSERT INTO `__new_board`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `board`;--> statement-breakpoint
+DROP TABLE `board`;--> statement-breakpoint
+ALTER TABLE `__new_board` RENAME TO `board`;--> statement-breakpoint
+CREATE TABLE `__new_task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:16.320Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+INSERT INTO `__new_task`("id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "board_id", "assignee_id", "title", "description", "status", "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_user` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `password` text NOT NULL,
+ `email` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:16.320Z"' 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_member` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T21:51:16.320Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" 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 file
diff --git a/apps/api/drizzle/0005_lyrical_marvex.sql b/apps/api/drizzle/0005_lyrical_marvex.sql
new file mode 100644
index 000000000..0652f7093
--- /dev/null
+++ b/apps/api/drizzle/0005_lyrical_marvex.sql
@@ -0,0 +1,67 @@
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:38.968Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_task`("id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at" FROM `task`;--> statement-breakpoint
+DROP TABLE `task`;--> statement-breakpoint
+ALTER TABLE `__new_task` RENAME TO `task`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE TABLE `__new_workspace_member` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T21:51:38.967Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" FROM `workspace_member`;--> statement-breakpoint
+DROP TABLE `workspace_member`;--> statement-breakpoint
+ALTER TABLE `__new_workspace_member` RENAME TO `workspace_member`;--> statement-breakpoint
+CREATE TABLE `__new_board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:38.968Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE no action
+);
+--> statement-breakpoint
+INSERT INTO `__new_board`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `board`;--> statement-breakpoint
+DROP TABLE `board`;--> statement-breakpoint
+ALTER TABLE `__new_board` RENAME TO `board`;--> 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-01-05T21:51:38.967Z"' 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_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:51:38.967Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "created_at" FROM `workspace`;--> statement-breakpoint
+DROP TABLE `workspace`;--> statement-breakpoint
+ALTER TABLE `__new_workspace` RENAME TO `workspace`;
\ No newline at end of file
diff --git a/apps/api/drizzle/0006_windy_sabra.sql b/apps/api/drizzle/0006_windy_sabra.sql
new file mode 100644
index 000000000..a7a439843
--- /dev/null
+++ b/apps/api/drizzle/0006_windy_sabra.sql
@@ -0,0 +1,67 @@
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T21:52:34.989Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_board`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `board`;--> statement-breakpoint
+DROP TABLE `board`;--> statement-breakpoint
+ALTER TABLE `__new_board` RENAME TO `board`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE TABLE `__new_task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T21:52:34.989Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_task`("id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "board_id", "assignee_id", "title", "description", "status", "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_workspace_member` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T21:52:34.989Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" FROM `workspace_member`;--> statement-breakpoint
+DROP TABLE `workspace_member`;--> statement-breakpoint
+ALTER TABLE `__new_workspace_member` RENAME TO `workspace_member`;--> 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-01-05T21:52:34.989Z"' 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_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:52:34.989Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "created_at" FROM `workspace`;--> statement-breakpoint
+DROP TABLE `workspace`;--> statement-breakpoint
+ALTER TABLE `__new_workspace` RENAME TO `workspace`;
\ No newline at end of file
diff --git a/apps/api/drizzle/0007_reflective_microchip.sql b/apps/api/drizzle/0007_reflective_microchip.sql
new file mode 100644
index 000000000..7327e0d8a
--- /dev/null
+++ b/apps/api/drizzle/0007_reflective_microchip.sql
@@ -0,0 +1,67 @@
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T21:53:53.178Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_board`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `board`;--> statement-breakpoint
+DROP TABLE `board`;--> statement-breakpoint
+ALTER TABLE `__new_board` RENAME TO `board`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE TABLE `__new_task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T21:53:53.178Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_task`("id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "board_id", "assignee_id", "title", "description", "status", "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_user` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `password` text NOT NULL,
+ `email` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:53:53.177Z"' 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_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T21:53:53.178Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "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_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T21:53:53.178Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" 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 file
diff --git a/apps/api/drizzle/0008_black_electro.sql b/apps/api/drizzle/0008_black_electro.sql
new file mode 100644
index 000000000..5c1d0a53d
--- /dev/null
+++ b/apps/api/drizzle/0008_black_electro.sql
@@ -0,0 +1,77 @@
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_board` (
+ `id` text PRIMARY KEY NOT NULL,
+ `workspace_id` text NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `created_at` integer DEFAULT '"2025-01-05T22:09:42.868Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_board`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `board`;--> statement-breakpoint
+DROP TABLE `board`;--> statement-breakpoint
+ALTER TABLE `__new_board` RENAME TO `board`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE TABLE `__new_session` (
+ `id` text PRIMARY KEY NOT NULL,
+ `user_id` text NOT NULL,
+ `expires_at` integer NOT NULL,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_session`("id", "user_id", "expires_at") SELECT "id", "user_id", "expires_at" FROM `session`;--> statement-breakpoint
+DROP TABLE `session`;--> statement-breakpoint
+ALTER TABLE `__new_session` RENAME TO `session`;--> statement-breakpoint
+CREATE TABLE `__new_task` (
+ `id` text PRIMARY KEY NOT NULL,
+ `board_id` text NOT NULL,
+ `assignee_id` text NOT NULL,
+ `title` text NOT NULL,
+ `description` text,
+ `status` text DEFAULT 'to-do' NOT NULL,
+ `due_date` integer,
+ `created_at` integer DEFAULT '"2025-01-05T22:09:42.868Z"' NOT NULL,
+ FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_task`("id", "board_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "board_id", "assignee_id", "title", "description", "status", "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_workspace` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `description` text,
+ `owner_id` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-01-05T22:09:42.867Z"' NOT NULL,
+ FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "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_id` text NOT NULL,
+ `role` text,
+ `joined_at` integer DEFAULT '"2025-01-05T22:09:42.867Z"' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" FROM `workspace_member`;--> statement-breakpoint
+DROP TABLE `workspace_member`;--> statement-breakpoint
+ALTER TABLE `__new_workspace_member` RENAME TO `workspace_member`;--> 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-01-05T22:09:42.867Z"' 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`);
\ No newline at end of file
diff --git a/apps/api/drizzle/meta/0003_snapshot.json b/apps/api/drizzle/meta/0003_snapshot.json
new file mode 100644
index 000000000..94b49c0ae
--- /dev/null
+++ b/apps/api/drizzle/meta/0003_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "64109be0-fa20-41a8-aefd-3c6bc53e94d3",
+ "prevId": "1c74d9e8-3e5e-4199-9175-7514767a6912",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T21:49:54.348Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task": {
+ "name": "task",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T21:49:54.348Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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-01-05T21:49:54.347Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:49:54.347Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:49:54.347Z\"'"
+ }
+ },
+ "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": "no action",
+ "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": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0004_snapshot.json b/apps/api/drizzle/meta/0004_snapshot.json
new file mode 100644
index 000000000..6ecaf8b83
--- /dev/null
+++ b/apps/api/drizzle/meta/0004_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "66df98fd-0af4-4151-9aad-14edaa811ba3",
+ "prevId": "64109be0-fa20-41a8-aefd-3c6bc53e94d3",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T21:51:16.320Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task": {
+ "name": "task",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T21:51:16.320Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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-01-05T21:51:16.320Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:51:16.320Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:51:16.320Z\"'"
+ }
+ },
+ "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": "no action",
+ "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": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0005_snapshot.json b/apps/api/drizzle/meta/0005_snapshot.json
new file mode 100644
index 000000000..62bf9febf
--- /dev/null
+++ b/apps/api/drizzle/meta/0005_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "79900e77-5a5a-4d24-beff-2d0b50ea3e94",
+ "prevId": "66df98fd-0af4-4151-9aad-14edaa811ba3",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T21:51:38.968Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task": {
+ "name": "task",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T21:51:38.968Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "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": "no action"
+ }
+ },
+ "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-01-05T21:51:38.967Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:51:38.967Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:51:38.967Z\"'"
+ }
+ },
+ "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": "no action",
+ "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": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0006_snapshot.json b/apps/api/drizzle/meta/0006_snapshot.json
new file mode 100644
index 000000000..693441fbc
--- /dev/null
+++ b/apps/api/drizzle/meta/0006_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "df646c60-7bb0-4626-a061-a835a20af5d6",
+ "prevId": "79900e77-5a5a-4d24-beff-2d0b50ea3e94",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T21:52:34.989Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task": {
+ "name": "task",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T21:52:34.989Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "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": "no action"
+ }
+ },
+ "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-01-05T21:52:34.989Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:52:34.989Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:52:34.989Z\"'"
+ }
+ },
+ "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": "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": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0007_snapshot.json b/apps/api/drizzle/meta/0007_snapshot.json
new file mode 100644
index 000000000..bbb616087
--- /dev/null
+++ b/apps/api/drizzle/meta/0007_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "c0ba8524-5b32-4413-b5bf-7a1ab6e20252",
+ "prevId": "df646c60-7bb0-4626-a061-a835a20af5d6",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T21:53:53.178Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "tableTo": "workspace",
+ "columnsFrom": ["workspace_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "task": {
+ "name": "task",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T21:53:53.178Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "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": "no action"
+ }
+ },
+ "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-01-05T21:53:53.177Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:53:53.178Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T21:53:53.178Z\"'"
+ }
+ },
+ "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": "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": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/apps/api/drizzle/meta/0008_snapshot.json b/apps/api/drizzle/meta/0008_snapshot.json
new file mode 100644
index 000000000..647787fc5
--- /dev/null
+++ b/apps/api/drizzle/meta/0008_snapshot.json
@@ -0,0 +1,375 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "cc45f253-5810-4589-8c71-d68c71e4074b",
+ "prevId": "c0ba8524-5b32-4413-b5bf-7a1ab6e20252",
+ "tables": {
+ "board": {
+ "name": "board",
+ "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
+ },
+ "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-01-05T22:09:42.868Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_workspace_id_workspace_id_fk": {
+ "name": "board_workspace_id_workspace_id_fk",
+ "tableFrom": "board",
+ "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
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "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'"
+ },
+ "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-01-05T22:09:42.868Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "task_board_id_board_id_fk": {
+ "name": "task_board_id_board_id_fk",
+ "tableFrom": "task",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "task_assignee_id_user_id_fk": {
+ "name": "task_assignee_id_user_id_fk",
+ "tableFrom": "task",
+ "tableTo": "user",
+ "columnsFrom": ["assignee_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "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-01-05T22:09:42.867Z\"'"
+ }
+ },
+ "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_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T22:09:42.867Z\"'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "workspace_owner_id_user_id_fk": {
+ "name": "workspace_owner_id_user_id_fk",
+ "tableFrom": "workspace",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "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_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "joined_at": {
+ "name": "joined_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'\"2025-01-05T22:09:42.867Z\"'"
+ }
+ },
+ "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"
+ },
+ "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": "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.json
index aa65f0b43..44448ae72 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -22,6 +22,48 @@
"when": 1736029469835,
"tag": "0002_flowery_secret_warriors",
"breakpoints": true
+ },
+ {
+ "idx": 3,
+ "version": "6",
+ "when": 1736113794356,
+ "tag": "0003_mature_madripoor",
+ "breakpoints": true
+ },
+ {
+ "idx": 4,
+ "version": "6",
+ "when": 1736113876330,
+ "tag": "0004_quiet_vector",
+ "breakpoints": true
+ },
+ {
+ "idx": 5,
+ "version": "6",
+ "when": 1736113898977,
+ "tag": "0005_lyrical_marvex",
+ "breakpoints": true
+ },
+ {
+ "idx": 6,
+ "version": "6",
+ "when": 1736113955000,
+ "tag": "0006_windy_sabra",
+ "breakpoints": true
+ },
+ {
+ "idx": 7,
+ "version": "6",
+ "when": 1736114033188,
+ "tag": "0007_reflective_microchip",
+ "breakpoints": true
+ },
+ {
+ "idx": 8,
+ "version": "6",
+ "when": 1736114982878,
+ "tag": "0008_black_electro",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index c28ffdddf..221a26e76 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -18,11 +18,92 @@ export const sessionTable = sqliteTable("session", {
id: text("id").primaryKey(),
userId: text("user_id")
.notNull()
- .references(() => userTable.id),
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
expiresAt: integer("expires_at", {
mode: "timestamp",
}).notNull(),
});
-export type User = InferSelectModel<typeof userTable>;
-export type Session = InferSelectModel<typeof sessionTable>;
+export const workspaceTable = sqliteTable("workspace", {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ name: text("name").notNull(),
+ description: text("description"),
+ ownerId: text("owner_id")
+ .notNull()
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ createdAt: integer("created_at", { mode: "timestamp" })
+ .default(new Date())
+ .notNull(),
+});
+
+export const workspaceUserTable = sqliteTable("workspace_member", {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ workspaceId: text("workspace_id")
+ .notNull()
+ .references(() => workspaceTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ userId: text("user_id")
+ .notNull()
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ role: text("role"),
+ joinedAt: integer("joined_at", { mode: "timestamp" })
+ .default(new Date())
+ .notNull(),
+});
+
+export const boardTable = sqliteTable("board", {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ workspaceId: text("workspace_id")
+ .notNull()
+ .references(() => workspaceTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ name: text("name").notNull(),
+ description: text("description"),
+ createdAt: integer("created_at", { mode: "timestamp" })
+ .default(new Date())
+ .notNull(),
+});
+
+export const taskTable = sqliteTable("task", {
+ id: text("id")
+ .$defaultFn(() => createId())
+ .primaryKey(),
+ boardId: text("board_id")
+ .notNull()
+ .references(() => boardTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ assigneeId: text("assignee_id")
+ .notNull()
+ .references(() => userTable.id, {
+ onDelete: "cascade",
+ onUpdate: "cascade",
+ }),
+ title: text("title").notNull(),
+ description: text("description"),
+ status: text("status").notNull().default("to-do"),
+ dueDate: integer("due_date", { mode: "timestamp" }),
+ createdAt: integer("created_at", { mode: "timestamp" })
+ .default(new Date())
+ .notNull(),
+});
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 393090553..cbbdc2bad 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -2,14 +2,16 @@ import { cors } from "@elysiajs/cors";
import { Elysia } from "elysia";
import user from "./user";
import { validateSessionToken } from "./user/controllers/validate-session-token";
+import workspace from "./workspace";
const app = new Elysia()
+ .state("userId", "")
.use(cors())
.use(user)
.guard({
- async beforeHandle({ set, cookie: { session } }) {
+ async beforeHandle({ set, store, cookie: { session } }) {
if (!session?.value) {
- return { user: null, session: null };
+ return { user: null };
}
const { user, session: validatedSession } = await validateSessionToken(
@@ -17,15 +19,22 @@ const app = new Elysia()
);
if (!user || !validatedSession) {
- return { user: null, session: null };
+ return { user: null };
}
+
+ store.userId = user.id;
},
})
.get("/me", async ({ cookie: { session } }) => {
const { user } = await validateSessionToken(session.value ?? "");
- return user;
+ if (user === null) {
+ return { user: null };
+ }
+
+ return { user };
})
+ .use(workspace)
.onError(({ code, error }) => {
switch (code) {
case "VALIDATION":
diff --git a/apps/api/src/user/types.ts b/apps/api/src/user/types.ts
index e510b339d..c57a4b90a 100644
--- a/apps/api/src/user/types.ts
+++ b/apps/api/src/user/types.ts
@@ -1,4 +1,8 @@
-import type { Session, User } from "../database/schema";
+import type { InferSelectModel } from "drizzle-orm";
+import type { sessionTable, userTable } from "../database/schema";
+
+export type User = InferSelectModel<typeof userTable>;
+export type Session = InferSelectModel<typeof sessionTable>;
export type SessionValidationResult =
| { session: Session; user: User }
diff --git a/apps/api/src/workspace/controllers/create-workspace.ts b/apps/api/src/workspace/controllers/create-workspace.ts
new file mode 100644
index 000000000..ab7ba8970
--- /dev/null
+++ b/apps/api/src/workspace/controllers/create-workspace.ts
@@ -0,0 +1,12 @@
+import type { Static } from "elysia";
+import db from "../../database";
+import { workspaceTable } from "../../database/schema";
+import type { createWorkspaceSchema } from "../db/queries";
+
+type CreateWorkspaceArgs = Static<typeof createWorkspaceSchema>;
+
+async function createWorkspace(body: CreateWorkspaceArgs) {
+ return db.insert(workspaceTable).values(body);
+}
+
+export default createWorkspace;
diff --git a/apps/api/src/workspace/controllers/get-workspaces.ts b/apps/api/src/workspace/controllers/get-workspaces.ts
new file mode 100644
index 000000000..1d237c41f
--- /dev/null
+++ b/apps/api/src/workspace/controllers/get-workspaces.ts
@@ -0,0 +1,8 @@
+import db from "../../database";
+import { workspaceTable } from "../../database/schema";
+
+async function getWorkspaces() {
+ return db.select().from(workspaceTable);
+}
+
+export default getWorkspaces;
diff --git a/apps/api/src/workspace/db/queries.ts b/apps/api/src/workspace/db/queries.ts
new file mode 100644
index 000000000..a0e8c3299
--- /dev/null
+++ b/apps/api/src/workspace/db/queries.ts
@@ -0,0 +1,7 @@
+import { createInsertSchema } from "drizzle-typebox";
+import { t } from "elysia";
+import { workspaceTable } from "../../database/schema";
+
+export const createWorkspaceSchema = createInsertSchema(workspaceTable, {
+ name: t.String(),
+});
diff --git a/apps/api/src/workspace/index.ts b/apps/api/src/workspace/index.ts
new file mode 100644
index 000000000..2516a46be
--- /dev/null
+++ b/apps/api/src/workspace/index.ts
@@ -0,0 +1,43 @@
+import { eq, or } from "drizzle-orm";
+import Elysia from "elysia";
+import db from "../database";
+import { workspaceTable, workspaceUserTable } from "../database/schema";
+import createWorkspace from "./controllers/create-workspace";
+import { createWorkspaceSchema } from "./db/queries";
+
+const workspace = new Elysia({ prefix: "/workspace" })
+ .state("userId", "")
+ .post(
+ "/",
+ async ({ body }) => {
+ const createdWorkspace = await createWorkspace(body);
+
+ return createdWorkspace;
+ },
+ {
+ body: createWorkspaceSchema,
+ },
+ )
+ .get("/workspaces", async ({ store }) => {
+ const userId = store.userId;
+
+ const workspaces = await db
+ .select()
+ .from(workspaceTable)
+ .leftJoin(
+ workspaceUserTable,
+ eq(workspaceTable.id, workspaceUserTable.workspaceId),
+ )
+ .where(
+ or(
+ eq(workspaceTable.ownerId, userId),
+ eq(workspaceUserTable.userId, userId),
+ ),
+ );
+
+ return workspaces;
+ })
+ .put("/:id", () => {})
+ .delete("/:id", () => {});
+
+export default workspace;
diff --git a/apps/web/public/logo.svg b/apps/web/public/logo.svg
index 89adda930..133f00b37 100644
--- a/apps/web/public/logo.svg
+++ b/apps/web/public/logo.svg
@@ -1,10 +1,10 @@
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d_1_14)">
<rect x="2" y="1" width="32" height="32" rx="4" fill="url(#paint0_linear_1_14)"/>
-<path d="M15 8H10C9.44772 8 9 8.44772 9 9V14C9 14.5523 9.44772 15 10 15H15C15.5523 15 16 14.5523 16 14V9C16 8.44772 15.5523 8 15 8Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M15 19H10C9.44772 19 9 19.4477 9 20V25C9 25.5523 9.44772 26 10 26H15C15.5523 26 16 25.5523 16 25V20C16 19.4477 15.5523 19 15 19Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M26 8H21C20.4477 8 20 8.44772 20 9V14C20 14.5523 20.4477 15 21 15H26C26.5523 15 27 14.5523 27 14V9C27 8.44772 26.5523 8 26 8Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-<path d="M26 19H21C20.4477 19 20 19.4477 20 20V25C20 25.5523 20.4477 26 21 26H26C26.5523 26 27 25.5523 27 25V20C27 19.4477 26.5523 19 26 19Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M14.75 7.25H9.33333C8.73502 7.25 8.25 7.73502 8.25 8.33333V13.75C8.25 14.3483 8.73502 14.8333 9.33333 14.8333H14.75C15.3483 14.8333 15.8333 14.3483 15.8333 13.75V8.33333C15.8333 7.73502 15.3483 7.25 14.75 7.25Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M26.6667 7.25H21.25C20.6517 7.25 20.1667 7.73502 20.1667 8.33333V13.75C20.1667 14.3483 20.6517 14.8333 21.25 14.8333H26.6667C27.265 14.8333 27.75 14.3483 27.75 13.75V8.33333C27.75 7.73502 27.265 7.25 26.6667 7.25Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M26.6667 19.1667H21.25C20.6517 19.1667 20.1667 19.6517 20.1667 20.25V25.6667C20.1667 26.265 20.6517 26.75 21.25 26.75H26.6667C27.265 26.75 27.75 26.265 27.75 25.6667V20.25C27.75 19.6517 27.265 19.1667 26.6667 19.1667Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M14.75 19.1667H9.33333C8.73502 19.1667 8.25 19.6517 8.25 20.25V25.6667C8.25 26.265 8.73502 26.75 9.33333 26.75H14.75C15.3483 26.75 15.8333 26.265 15.8333 25.6667V20.25C15.8333 19.6517 15.3483 19.1667 14.75 19.1667Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<filter id="filter0_d_1_14" x="0" y="0" width="36" height="36" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
diff --git a/apps/web/src/components/auth/sign-in-form.tsx b/apps/web/src/components/auth/sign-in-form.tsx
index e0add88ae..41d163568 100644
--- a/apps/web/src/components/auth/sign-in-form.tsx
+++ b/apps/web/src/components/auth/sign-in-form.tsx
@@ -47,7 +47,10 @@ export function SignInForm() {
const onSubmit = async () => {
const { data: user } = await mutateAsync();
setUser(user);
- history.push("/dashboard");
+
+ setTimeout(() => {
+ history.push("/dashboard");
+ }, 500);
};
return (
diff --git a/apps/web/src/components/auth/sign-up-form.tsx b/apps/web/src/components/auth/sign-up-form.tsx
index 8ec7943fc..f1a34687a 100644
--- a/apps/web/src/components/auth/sign-up-form.tsx
+++ b/apps/web/src/components/auth/sign-up-form.tsx
@@ -51,7 +51,10 @@ export function SignUpForm() {
const onSubmit = async () => {
const { data: user } = await mutateAsync();
setUser(user);
- history.push("/dashboard");
+
+ setTimeout(() => {
+ history.push("/dashboard");
+ }, 500);
};
return (
diff --git a/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx b/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx
index 5f41e2810..56c9ec243 100644
--- a/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx
+++ b/apps/web/src/components/common/sidebar/sections/workspaces/index.tsx
@@ -6,6 +6,10 @@ const workspaces = [
id: "1",
name: "Personal Workspace",
},
+ {
+ id: "2",
+ name: "Uni Workspace",
+ },
];
function Workspaces() {
diff --git a/apps/web/src/components/providers/auth-provider/index.tsx b/apps/web/src/components/providers/auth-provider/index.tsx
index f1e3b3866..8e5f59a47 100644
--- a/apps/web/src/components/providers/auth-provider/index.tsx
+++ b/apps/web/src/components/providers/auth-provider/index.tsx
@@ -1,39 +1,45 @@
import useGetMe from "@/hooks/queries/use-get-me";
-import type { User } from "@/types/user";
+import type { LoggedInUser, User } from "@/types/user";
import { LayoutGrid } from "lucide-react";
import {
+ type Dispatch,
type PropsWithChildren,
+ type SetStateAction,
createContext,
useEffect,
+ useMemo,
useState,
} from "react";
export const AuthContext = createContext<{
- user: User | null;
- setUser: (user: User) => void;
+ user: LoggedInUser | null | undefined;
+ setUser: Dispatch<SetStateAction<LoggedInUser | null | undefined>>;
}>({
- user: null,
- setUser: () => {},
+ user: undefined,
+ setUser: () => undefined,
});
function AuthProvider({ children }: PropsWithChildren) {
- const [user, setUser] = useState<{
- name: string;
- id: string;
- password: string;
- email: string;
- createdAt: Date;
- } | null>(null);
-
+ const [user, setUser] = useState<LoggedInUser | undefined | null>(undefined);
const { data, isFetching } = useGetMe();
useEffect(() => {
- if (data) {
- setUser(data.data);
+ if (data?.data?.user === null) {
+ setUser(null);
+ } else if (data?.data?.user) {
+ setUser({ ...data?.data?.user });
}
}, [data]);
- if (isFetching) {
+ const memoizedValues = useMemo(
+ () => ({
+ user,
+ setUser,
+ }),
+ [user],
+ );
+
+ if (isFetching || user === undefined) {
return (
<div className="flex w-full items-center justify-center h-screen flex-col md:flex-row bg-zinc-50 dark:bg-zinc-950">
<div className="p-1.5 bg-gradient-to-br from-indigo-500 to-purple-500 rounded-lg shadow-sm animate-spin">
@@ -44,12 +50,7 @@ function AuthProvider({ children }: PropsWithChildren) {
}
return (
- <AuthContext.Provider
- value={{
- user,
- setUser,
- }}
- >
+ <AuthContext.Provider value={memoizedValues}>
{children}
</AuthContext.Provider>
);
diff --git a/apps/web/src/routes/dashboard/index.tsx b/apps/web/src/routes/dashboard/index.tsx
index c637521d2..c28104524 100644
--- a/apps/web/src/routes/dashboard/index.tsx
+++ b/apps/web/src/routes/dashboard/index.tsx
@@ -1,18 +1,11 @@
import { Sidebar } from "@/components/common/sidebar";
-import type { User } from "@/types/user";
import { redirect } from "@tanstack/react-router";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/dashboard/")({
component: DashboardIndexRouteComponent,
- async beforeLoad({ context: { user, queryClient } }) {
- const queryData = await queryClient.ensureQueryData<{
- data: User;
- }>({
- queryKey: ["me"],
- });
-
- if (!user && !queryData?.data) {
+ async beforeLoad({ context: { user } }) {
+ if (user === null) {
throw redirect({
to: "/auth/sign-in",
});
diff --git a/apps/web/src/types/user.ts b/apps/web/src/types/user.ts
index 13b6e84d0..6226484b1 100644
--- a/apps/web/src/types/user.ts
+++ b/apps/web/src/types/user.ts
@@ -1,4 +1,12 @@
import type { api } from "@kaneo/libs";
import type ApiResponse from "./api-response";
-export type User = ApiResponse<typeof api.me.get>;
+export type User = NonNullable<ApiResponse<typeof api.me.get>> | undefined;
+
+export type LoggedInUser = {
+ name: string;
+ id: string;
+ password: string;
+ email: string;
+ createdAt: Date;
+};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 119c8900e..d82826e8a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -44,13 +44,13 @@ importers:
dependencies:
'@elysiajs/cors':
specifier: ^1.2.0
'@elysiajs/jwt':
specifier: ^1.2.0
'@elysiajs/websocket':
specifier: ^0.2.8
'@kaneo/typescript-config':
specifier: workspace:*
version: link:../../packages/typescript-config
@@ -77,7 +77,7 @@ importers:
elysia:
specifier: latest
- version: 1.2.9(@sinclair/[email protected])([email protected])
+ version: 1.2.10(@sinclair/[email protected])([email protected])
devDependencies:
bun-types:
specifier: latest
@@ -1787,6 +1787,18 @@ packages:
resolution: {integrity: sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==}
+ resolution: {integrity: sha512-QcNl2FjhHFRpKaqy1NoMpyCjJ7OcKBnHwLUkqGu09QwIV84PFb82ILvYJG4GS1RbGv76OA50luaqBLrM3SLZ2w==}
+ peerDependencies:
+ '@sinclair/typebox': '>= 0.34.0'
+ openapi-types: '>= 12.0.0'
+ typescript: '>= 5.0.0'
+ peerDependenciesMeta:
+ openapi-types:
+ optional: true
+ typescript:
+ optional: true
+
resolution: {integrity: sha512-UqN0j3K5hVnTbrqy6wsyqw4/F5ZdWlBJGPP1ax3JbcwEkKiWLA7HCPDaD+Tahq+h7kgUNKDT6WuIPAoN3rdXBg==}
peerDependencies:
@@ -2958,22 +2970,22 @@ snapshots:
'@drizzle-team/[email protected]': {}
dependencies:
- elysia: 1.2.9(@sinclair/[email protected])([email protected])
+ elysia: 1.2.10(@sinclair/[email protected])([email protected])
dependencies:
elysia: 1.2.9(@sinclair/[email protected])([email protected])
dependencies:
- elysia: 1.2.9(@sinclair/[email protected])([email protected])
+ elysia: 1.2.10(@sinclair/[email protected])([email protected])
jose: 4.15.9
dependencies:
- elysia: 1.2.9(@sinclair/[email protected])([email protected])
+ elysia: 1.2.10(@sinclair/[email protected])([email protected])
nanoid: 4.0.2
raikiri: 0.0.0-beta.8
@@ -3897,6 +3909,14 @@ snapshots:
+ dependencies:
+ '@sinclair/typebox': 0.34.13
+ cookie: 1.0.2
+ memoirist: 0.2.0
+ optionalDependencies:
+ typescript: 5.6.3
+
dependencies:
'@sinclair/typebox': 0.34.13