feat: list + task endpoints and CORS, verified end-to-end
This commit is contained in:
10
server/api/lists/[id]/tasks.get.ts
Normal file
10
server/api/lists/[id]/tasks.get.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// 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);
|
||||
});
|
||||
Reference in New Issue
Block a user