feat(api): pages routes + revisions + backlinks

Add lib/api/routes/pages.js: list by space, create/get/patch/delete,
get-by-slug, list revisions, and backlinks via entity_links.listTo
enriched with the source entity's title (whitelisted entity_type set
to keep the dynamic-table SELECT bounded).

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

View File

@@ -8,6 +8,7 @@ import {
spacesScopedRouter as tasksBySpaceRouter,
projectsScopedRouter as tasksByProjectRouter
} from './routes/tasks.js';
import { router as pagesRouter, spacesScopedRouter as pagesBySpaceRouter } from './routes/pages.js';
export function mountApi(app) {
const api = Router();
@@ -16,9 +17,11 @@ export function mountApi(app) {
api.use('/spaces', spacesRouter);
api.use('/spaces/:space_id/projects', projectsBySpaceRouter);
api.use('/spaces/:space_id/tasks', tasksBySpaceRouter);
api.use('/spaces/:space_id/pages', pagesBySpaceRouter);
api.use('/projects', projectsRouter);
api.use('/projects/:project_id/tasks', tasksByProjectRouter);
api.use('/tasks', tasksRouter);
api.use('/pages', pagesRouter);
api.use((_req, _res, next) => next(new NotFoundError('route not found')));