Events
PREQSTATION writes mutation events to events_outbox. The web app reads those events through /api/events for audit and integration workflows.
Event Types
Common event types include:
Task events
| Event | Meaning |
|---|---|
TASK_CREATED | A task was created |
TASK_STATUS_CHANGED | Workflow status changed |
TASK_UPDATED | Task fields changed |
TASK_DELETED | A task was deleted |
Work log events
| Event | Meaning |
|---|---|
WORKLOG_CREATED | A work log entry was created |
WORKLOG_UPDATED | A work log entry was updated |
WORKLOG_DELETED | A work log entry was deleted |
Project events
| Event | Meaning |
|---|---|
PROJECT_CREATED | A project was created |
PROJECT_DELETED | A project was deleted |
events_outbox Schema
The current table shape is:
CREATE TABLE events_outbox ( id BIGSERIAL PRIMARY KEY, owner_id UUID NOT NULL, project_id UUID, event_type TEXT NOT NULL, entity_type TEXT NOT NULL, entity_id TEXT NOT NULL, payload JSONB, created_at TIMESTAMP WITH TIME ZONE NOT NULL);Key points:
idis a monotonic cursor, not a UUIDentity_idis text because it may contain a task key such asPROJ-123- there is no
processed_atcolumn in the current schema
/api/events
GET /api/events is an internal session-auth endpoint.
Query parameters:
after(optional): last event cursor already processedprojectId(optional): filter to one project UUIDlimit(optional): defaults to50, max100
Response shape:
{ "events": [ { "id": "42", "eventType": "TASK_STATUS_CHANGED", "entityType": "task", "entityId": "PROJ-123", "payload": { "from": "todo", "to": "ready" }, "createdAt": "2026-03-12T14:35:00.000Z" } ], "nextCursor": "42"}Polling Pattern
- Call
/api/events - Process returned events in order
- Save
nextCursor - Poll again with
?after=<nextCursor>
Work Logs and Events
Task lifecycle mutations often create work logs behind the scenes. For example, preq_complete_task() writes a work log entry and also emits WORKLOG_CREATED plus task events.
Typical Uses
- audit trails
- notifications
- lightweight internal integrations
- activity timelines