feat(api): tasks routes

Add lib/api/routes/tasks.js: list by space (status filter), list by
project (position then created_at), create scoped to space with
optional project_id, get/patch/delete by id. status=done flips
completed_at via the repo's existing trigger logic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
root
2026-05-31 20:46:39 +10:00
parent 1208b3bd40
commit 50649bea5f
3 changed files with 168 additions and 0 deletions

View File

@@ -3,6 +3,11 @@ import { ownerOnly } from '../auth/owner.js';
import { errorMiddleware, NotFoundError } from './errors.js';
import { router as spacesRouter } from './routes/spaces.js';
import { router as projectsRouter, spacesScopedRouter as projectsBySpaceRouter } from './routes/projects.js';
import {
router as tasksRouter,
spacesScopedRouter as tasksBySpaceRouter,
projectsScopedRouter as tasksByProjectRouter
} from './routes/tasks.js';
export function mountApi(app) {
const api = Router();
@@ -10,7 +15,10 @@ export function mountApi(app) {
api.use('/spaces', spacesRouter);
api.use('/spaces/:space_id/projects', projectsBySpaceRouter);
api.use('/spaces/:space_id/tasks', tasksBySpaceRouter);
api.use('/projects', projectsRouter);
api.use('/projects/:project_id/tasks', tasksByProjectRouter);
api.use('/tasks', tasksRouter);
api.use((_req, _res, next) => next(new NotFoundError('route not found')));