kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
at main 25 lines 564 B view raw
1import { eq } from "drizzle-orm"; 2import { HTTPException } from "hono/http-exception"; 3import db from "../../database"; 4import { taskTable } from "../../database/schema"; 5import getTask from "./get-task"; 6 7async function deleteTask(taskId: string) { 8 const task = await getTask(taskId); 9 10 const [deletedTask] = await db 11 .delete(taskTable) 12 .where(eq(taskTable.id, taskId)) 13 .returning() 14 .execute(); 15 16 if (!deletedTask) { 17 throw new HTTPException(404, { 18 message: "Task not found", 19 }); 20 } 21 22 return task; 23} 24 25export default deleteTask;