feat(workflows): add ticket templates for new-ticket pre-fill (PMS-448) #387
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-448-ticket-templates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Completes the last open acceptance criterion of the v1 automation
engine: "Tickets can have templates". The workflow-rule engine (rule authoring, firing on ticket events, and the workflow_rule_runs audit log) already shipped; ticket templates were the remaining gap.
Adds a tenant-scoped
ticket_templatestable (migration 083) plus a newticket_templatesmodule exposing admin-gated CRUD at/api/v1/ticket-templates. A template names a reusable new-ticket pre-fill (e.g. "Server is down") carrying a subject (tickets.title), body (tickets.description), and optional category / priority / type defaults. The SPA lists active templates on the new-ticket screen and seeds the form from the chosen row; the server stores and serves definitions only, so creating a ticket from a template stays a plain ticket create and the existing create path (audit + SLA + ticket.created rules) runs unchanged.The lookup FKs are nullable and ON DELETE SET NULL so retiring a category does not cascade-delete templates. PATCH uses double-Option fields so an explicit JSON null clears a FK while an absent key leaves it untouched.
?active_only=truenarrows the list to the picker view. Same-tenant integrity is enforced at the service layer, matching the repo's no-middleware-tenant-scoping posture.Adds a Postgres-backed integration test covering the CRUD round-trip, the active_only filter, the admin gate (technician is 403), FK-clear PATCH semantics, and delete-then-404.
#PMS-448