Scheduling & Approvals
Two related subsystems sit in front of publishing: scheduled actions (publish or unpublish a page at a future time) and approval requests (gate a publish behind a reviewer). They can be combined — a scheduled publish can carry an attached approval.
Routes: apps/cms/src/server/routes/scheduled-actions.ts,
apps/cms/src/server/routes/approval-requests.ts. Both are scoped to the active
(space, edition).
Scheduled actions
A row in scheduled_actions records a page, an action (publish/unpublish), a
scheduled_at timestamp, and a status (pending / executed / cancelled /
failed). A Cron trigger (configured in wrangler.jsonc, runs every minute)
picks up due pending rows and executes them via the shared publishPage
utility.
| Method & path | Purpose |
|---|---|
GET / | List scheduled actions for the edition (joins page + creator + any linked approval). |
DELETE /:id | Cancel a pending scheduled action. |
The list query left-joins approval_requests so the dashboard can show whether a
scheduled publish is also awaiting approval.
Approval requests
A row in approval_requests records the requester, the page, a status, and an
optional review comment. A user with approval rights approves or rejects it;
approving carries the publish through (again via publishPage), rejecting leaves
the page unpublished.
| Method & path | Purpose |
|---|---|
GET / | List approval requests (filter by status / page_id). |
| approve / reject | Transition a request; gated by checkUserCanApprove (apps/cms/src/server/utils/approval.ts). |
Whether approval is required, and who may approve, depends on space roles. All transitions write to the audit log and fire any configured webhooks.