Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: adding position of tickets in columns

Andrej93556e7f71ae
diff --git a/apps/api/drizzle/0001_short_imperial_guard.sql b/apps/api/drizzle/0001_short_imperial_guard.sql
new file mode 100644
index 000000000..483c98136
--- /dev/null
+++ b/apps/api/drizzle/0001_short_imperial_guard.sql
@@ -0,0 +1,87 @@
+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-03-13T21:45:13.973Z"' 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_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-03-13T21:45:13.973Z"' 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-03-13T21:45:13.973Z"' 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_user` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `password` text NOT NULL,
+ `email` text NOT NULL,
+ `created_at` integer DEFAULT '"2025-03-13T21:45:13.972Z"' 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-03-13T21:45:13.973Z"' 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 NOT NULL,
+ `role` text DEFAULT 'member' NOT NULL,
+ `joined_at` integer DEFAULT '"2025-03-13T21:45:13.973Z"' NOT NULL,
+ `status` text DEFAULT 'pending' NOT NULL,
+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`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_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 file
diff --git a/apps/api/drizzle/meta/0001_snapshot.json b/apps/api/drizzle/meta/0001_snapshot.json
new file mode 100644
index 000000000..4e9949bc9
--- /dev/null
+++ b/apps/api/drizzle/meta/0001_snapshot.json
@@ -0,0 +1,495 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "8acd32cb-c859-4926-ae60-df1b4ea9a6bf",
+ "prevId": "f146a115-68e7-4707-b858-8d9029a87136",
+ "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-03-13T21:45:13.973Z\"'"
+ },
+ "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": {}
+ },
+ "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-03-13T21:45:13.973Z\"'"
+ }
+ },
+ "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-03-13T21:45:13.973Z\"'"
+ }
+ },
+ "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": {}
+ },
+ "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-03-13T21:45:13.972Z\"'"
+ }
+ },
+ "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-03-13T21:45:13.973Z\"'"
+ }
+ },
+ "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": true,
+ "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-03-13T21:45:13.973Z\"'"
+ },
+ "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"
+ },
+ "workspace_member_user_email_user_email_fk": {
+ "name": "workspace_member_user_email_user_email_fk",
+ "tableFrom": "workspace_member",
+ "tableTo": "user",
+ "columnsFrom": ["user_email"],
+ "columnsTo": ["email"],
+ "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 d32ca5c06..6b3b779b4 100644
--- a/apps/api/drizzle/meta/_journal.json
+++ b/apps/api/drizzle/meta/_journal.json
@@ -8,6 +8,13 @@
"when": 1740771205551,
"tag": "0000_cool_mattie_franklin",
"breakpoints": true
+ },
+ {
+ "idx": 1,
+ "version": "6",
+ "when": 1741902313985,
+ "tag": "0001_short_imperial_guard",
+ "breakpoints": true
}
]
}
diff --git a/apps/api/src/database/schema.ts b/apps/api/src/database/schema.ts
index 9f126585f..2b40be46b 100644
--- a/apps/api/src/database/schema.ts
+++ b/apps/api/src/database/schema.ts
@@ -95,6 +95,7 @@ export const taskTable = sqliteTable("task", {
onDelete: "cascade",
onUpdate: "cascade",
}),
+ position: integer("position").default(0),
number: int().default(1),
userEmail: text("assignee_email").references(() => userTable.email, {
onDelete: "cascade",
diff --git a/apps/api/src/task/controllers/get-tasks.ts b/apps/api/src/task/controllers/get-tasks.ts
index 61902a3b6..231576dd1 100644
--- a/apps/api/src/task/controllers/get-tasks.ts
+++ b/apps/api/src/task/controllers/get-tasks.ts
@@ -27,6 +27,7 @@ async function getTasks(projectId: string) {
status: taskTable.status,
priority: taskTable.priority,
dueDate: taskTable.dueDate,
+ position: taskTable.position,
createdAt: taskTable.createdAt,
userEmail: taskTable.userEmail,
assigneeName: userTable.name,
@@ -36,7 +37,8 @@ async function getTasks(projectId: string) {
.from(taskTable)
.leftJoin(userTable, eq(taskTable.userEmail, userTable.email))
.leftJoin(projectTable, eq(taskTable.projectId, projectTable.id))
- .where(eq(taskTable.projectId, projectId));
+ .where(eq(taskTable.projectId, projectId))
+ .orderBy(taskTable.position);
const columns = DEFAULT_COLUMNS.map((column) => ({
id: column.id,
diff --git a/apps/api/src/task/controllers/update-task.ts b/apps/api/src/task/controllers/update-task.ts
index d57a936c9..5dc0eb6f3 100644
--- a/apps/api/src/task/controllers/update-task.ts
+++ b/apps/api/src/task/controllers/update-task.ts
@@ -12,6 +12,7 @@ async function updateTask(
dueDate: Date | null;
description: string;
priority: string;
+ position: number;
},
) {
const [existingTask] = await db
@@ -34,6 +35,7 @@ async function updateTask(
dueDate: new Date(body.dueDate ?? ""),
priority: body.priority,
userEmail: body.userEmail,
+ position: body.position,
})
.where(eq(taskTable.id, taskId))
.returning();
diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.ts
index d6e6f8812..e0a11657b 100644
--- a/apps/api/src/task/index.ts
+++ b/apps/api/src/task/index.ts
@@ -21,6 +21,7 @@ const task = new Elysia({ prefix: "/task" })
dueDate: t.Date(),
description: t.String(),
priority: t.String(),
+ position: t.Number(),
}),
},
)
@@ -63,6 +64,7 @@ const task = new Elysia({ prefix: "/task" })
dueDate: t.Date(),
description: t.String(),
priority: t.String(),
+ position: t.Number(),
}),
},
);
diff --git a/apps/web/src/components/kanban-board/index.tsx b/apps/web/src/components/kanban-board/index.tsx
index 34651f265..2773e5360 100644
--- a/apps/web/src/components/kanban-board/index.tsx
+++ b/apps/web/src/components/kanban-board/index.tsx
@@ -77,7 +77,10 @@ function KanbanBoard({ project }: { project: Project | undefined }) {
destinationIndex += 1;
}
destinationColumn.tasks.splice(destinationIndex, 0, task);
- updateTask(task);
+
+ destinationColumn.tasks.forEach((t, index) => {
+ updateTask({ ...t, position: index + 1 });
+ });
} else {
const updatedTask = { ...task, status: destinationColumn.id };
const destinationIndex =
@@ -86,7 +89,10 @@ function KanbanBoard({ project }: { project: Project | undefined }) {
: destinationColumn.tasks.findIndex((t) => t.id === overId);
destinationColumn.tasks.splice(destinationIndex + 1, 0, updatedTask);
- updateTask(updatedTask);
+
+ destinationColumn.tasks.forEach((t, index) => {
+ updateTask({ ...t, position: index + 1 });
+ });
}
});
diff --git a/apps/web/src/components/task/create-task-modal.tsx b/apps/web/src/components/task/create-task-modal.tsx
index 349f1d15b..66bac5d99 100644
--- a/apps/web/src/components/task/create-task-modal.tsx
+++ b/apps/web/src/components/task/create-task-modal.tsx
@@ -70,6 +70,7 @@ export function CreateTaskModal({
projectId: project?.id,
dueDate: new Date(),
status: status ?? "to-do",
+ position: 0,
});
const updatedProject = produce(project, (draft) => {
@@ -80,12 +81,14 @@ export function CreateTaskModal({
targetColumn.tasks.push({
...newTask,
userEmail: data.email,
+ position: 0,
});
}
});
setProject(updatedProject);
- updateTask(newTask);
+
+ updateTask({ ...newTask, position: 0 });
form.reset();
onClose();
diff --git a/apps/web/src/components/task/task-description.tsx b/apps/web/src/components/task/task-description.tsx
index fdac4844c..0f0e2aa94 100644
--- a/apps/web/src/components/task/task-description.tsx
+++ b/apps/web/src/components/task/task-description.tsx
@@ -37,6 +37,7 @@ function TaskDescription({ setIsSaving }: TaskDescriptionProps) {
status: task.status || "",
dueDate: task.dueDate || new Date(),
priority: task.priority || "",
+ position: task.position || 0,
});
setIsSaving(false);
}, 1000);
diff --git a/apps/web/src/components/task/task-title.tsx b/apps/web/src/components/task/task-title.tsx
index eb10632a5..a93002207 100644
--- a/apps/web/src/components/task/task-title.tsx
+++ b/apps/web/src/components/task/task-title.tsx
@@ -33,6 +33,7 @@ function TaskTitle({
status: task.status || "",
dueDate: task.dueDate || new Date(),
priority: task.priority || "",
+ position: task.position || 0,
});
setIsSaving(false);
}, 1000);
diff --git a/apps/web/src/fetchers/task/create-task.ts b/apps/web/src/fetchers/task/create-task.ts
index d4c456d0e..b351145d8 100644
--- a/apps/web/src/fetchers/task/create-task.ts
+++ b/apps/web/src/fetchers/task/create-task.ts
@@ -1,6 +1,6 @@
import { api } from "@kaneo/libs";
-async function createProject(
+async function createTask(
title: string,
description: string,
projectId: string,
@@ -8,6 +8,7 @@ async function createProject(
status: string,
dueDate: Date,
priority: string,
+ position: number,
) {
const response = await api.task.create.post({
title,
@@ -17,6 +18,7 @@ async function createProject(
status,
dueDate,
priority,
+ position,
});
if (response.error) {
@@ -26,4 +28,4 @@ async function createProject(
return response?.data;
}
-export default createProject;
+export default createTask;
diff --git a/apps/web/src/fetchers/task/update-task.ts b/apps/web/src/fetchers/task/update-task.ts
index 1f0184d95..a140cc0f7 100644
--- a/apps/web/src/fetchers/task/update-task.ts
+++ b/apps/web/src/fetchers/task/update-task.ts
@@ -10,6 +10,7 @@ async function updateTask(taskId: string, task: Task) {
projectId: task.projectId,
priority: task.priority || "",
dueDate: task.dueDate || new Date(),
+ position: task.position || 0,
});
if (response.status !== 200) {
diff --git a/apps/web/src/hooks/mutations/task/use-create-task.ts b/apps/web/src/hooks/mutations/task/use-create-task.ts
index e37696555..3bdfd2a81 100644
--- a/apps/web/src/hooks/mutations/task/use-create-task.ts
+++ b/apps/web/src/hooks/mutations/task/use-create-task.ts
@@ -10,6 +10,7 @@ type CreateTaskInput = {
dueDate: Date;
number?: number;
priority: "low" | "medium" | "high" | "urgent";
+ position: number;
};
function useCreateTask() {
@@ -22,6 +23,7 @@ function useCreateTask() {
status,
dueDate,
priority,
+ position,
}: CreateTaskInput) =>
createTask(
title,
@@ -31,6 +33,7 @@ function useCreateTask() {
status,
dueDate,
priority,
+ position,
),
});
}
diff --git a/apps/web/src/types/project/index.ts b/apps/web/src/types/project/index.ts
index 3eb8310bb..b921ae775 100644
--- a/apps/web/src/types/project/index.ts
+++ b/apps/web/src/types/project/index.ts
@@ -25,4 +25,5 @@ export type Task = {
dueDate: Date | null;
priority: string | null;
projectSlug?: string;
+ position: number | null;
};
diff --git a/bun.lockb b/bun.lockb
index 9c506f3ff..1df9b9893 100755
Binary files a/bun.lockb and b/bun.lockb differ