Files
claudedo-online/server/api/lists/[id]/tasks.get.ts

11 lines
409 B
TypeScript

// GET /api/lists/:id/tasks (web) — Idle tasks for a list. 404 if the list is unknown.
export default defineEventHandler(async (event) => {
const id = getRouterParam(event, "id")!;
const sql = getSql();
if (!(await listExists(sql, id))) {
throw createError({ statusCode: 404, statusMessage: "list not found" });
}
const rows = await getTasksForList(sql, id);
return rows.map(toTaskDto);
});