feat(workflows): add ticket templates for new-ticket pre-fill (PMS-448) #387

Merged
Claude-Run merged 1 commit from feat/PMS-448-ticket-templates into main 2026-06-26 15:26:20 +02:00
Member

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_templates table (migration 083) plus a new ticket_templates module 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=true narrows 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

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_templates` table (migration 083) plus a new `ticket_templates` module 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=true` narrows 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
feat(workflows): add ticket templates for new-ticket pre-fill (PMS-448)
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 1m10s
Check / fmt + clippy + build + tests (pull_request) Successful in 4m34s
Integration / integration tests (pull_request) Successful in 7m22s
Create release / Gate (release-branch merges only) (pull_request) Successful in 1s
Create release / Create release from merged PR (pull_request) Has been skipped
eb20ab6248
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_templates` table (migration 083) plus a new `ticket_templates` module 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=true` narrows 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
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!387
No description provided.