kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
at main 38 lines 794 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 updateTaskAssignee({ 7 id, 8 userId, 9}: { 10 id: string; 11 userId: 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({ userId: userId || null }) 26 .where(eq(taskTable.id, id)) 27 .returning(); 28 29 if (!updatedTask) { 30 throw new HTTPException(500, { 31 message: "Failed to update task assignee", 32 }); 33 } 34 35 return updatedTask; 36} 37 38export default updateTaskAssignee;