kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { eq } from "drizzle-orm";
2import { HTTPException } from "hono/http-exception";
3import db from "../../database";
4import { taskTable } from "../../database/schema";
5
6async function updateTaskDescription({
7 id,
8 description,
9}: {
10 id: string;
11 description: string;
12}) {
13 const existingTask = await db.query.taskTable.findFirst({
14 where: eq(taskTable.id, id),
15 });
16
17 if (!existingTask) {
18 throw new HTTPException(404, {
19 message: "Task not found",
20 });
21 }
22
23 const [updatedTask] = await db
24 .update(taskTable)
25 .set({ description })
26 .where(eq(taskTable.id, id))
27 .returning();
28
29 if (!updatedTask) {
30 throw new HTTPException(500, {
31 message: "Failed to update task description",
32 });
33 }
34
35 return updatedTask;
36}
37
38export default updateTaskDescription;