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