mAi
a4e2f3526d
feat(checklists): t-paliad-225 Slice A backend — user-authored templates
m/paliad#61 Slice A. Introduces paliad.checklists (mig 114) as the
DB-backed companion to the static Go catalog. ChecklistCatalogService
unifies both sources at read time; ChecklistTemplateService handles
authoring CRUD + visibility toggle (private↔firm; Slice B opens
'shared' and 'global').
Schema (mig 114, idempotent):
- paliad.checklists (uuid, slug UNIQUE, owner_id FK, title/description
/regime/court/reference/deadline/lang, body jsonb, visibility CHECK
('private','shared','firm','global'), promoted_at/_by, timestamps)
- paliad.can_see_checklist(uuid, uuid) STABLE SECURITY DEFINER —
owner OR firm/global. Slice B extends with the explicit-share branch.
- RLS: select via can_see_checklist; insert owner=self; update/delete
owner OR global_admin
- ALTER paliad.checklist_instances ADD COLUMN template_snapshot jsonb
(snapshot semantics so per-Akte instances stay decoupled from
subsequent template edits)
Services:
- ChecklistCatalogService — ListVisible, Find, SnapshotBody, IsStaticSlug.
Reapplies visibility application-side (service-role bypasses RLS, per
visibility.go pattern). Static-slug map computed once at boot for
collision detection.
- ChecklistTemplateService — Create (auto-generates u-<slug>-<hex> with
retry), Update (changed_fields[] in audit), SetVisibility, Delete,
ListOwnedBy, GetBySlug. Owner-or-global_admin gate.
- SystemAuditLogService.WriteChecklistEvent — thin helper writing into
paliad.system_audit_log with scope='org'.
- ChecklistInstanceService.Create now captures template_snapshot via
the catalog; GetByID returns it inline so the frontend can render
the captured body even after the upstream template is mutated.
Endpoints (all owner-gated where mutating):
- GET /api/checklists — merged catalog (static + DB visible)
- GET /api/checklists/{slug} — single template; static-first lookup
- GET /api/checklists/templates/mine — caller's authored templates
- POST /api/checklists/templates — create
- PATCH /api/checklists/templates/{slug} — edit
- PATCH /api/checklists/templates/{slug}/visibility — private↔firm
- DELETE /api/checklists/templates/{slug} — delete
- GET /checklists/new, /checklists/{slug}/edit — author wizard pages
Tests: pure-helper unit tests cover slugifyTitle (umlaut → ae/oe/ue/ss
normalisation + clamp), regime/lang/visibility validation, body-shape
enforcement, static-slug detection, predicate shape, clamp.
2026-05-20 15:24:06 +02:00
..
2026-04-30 16:46:31 +02:00
2026-05-15 02:09:10 +02:00
2026-05-20 15:19:48 +02:00
2026-04-22 23:38:03 +02:00
2026-04-30 16:46:31 +02:00
2026-05-20 15:23:28 +02:00
2026-05-20 13:26:23 +02:00
2026-05-20 10:02:36 +02:00
2026-05-20 10:02:36 +02:00
2026-04-29 19:12:11 +02:00
2026-04-30 16:46:31 +02:00
2026-04-18 02:23:50 +02:00
2026-04-30 16:46:31 +02:00
2026-05-07 20:58:57 +02:00
2026-05-07 22:41:18 +02:00
2026-04-30 16:46:31 +02:00
2026-05-13 00:03:45 +02:00
2026-05-13 00:03:45 +02:00
2026-05-01 09:48:25 +02:00
2026-05-20 15:24:06 +02:00
2026-05-20 15:24:06 +02:00
2026-04-30 16:46:31 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 13:55:56 +02:00
2026-05-15 01:01:28 +02:00
2026-05-20 15:23:28 +02:00
2026-05-06 16:24:31 +02:00
2026-05-06 16:41:41 +02:00
2026-04-14 19:32:07 +02:00
2026-04-30 16:46:31 +02:00
2026-05-15 01:09:20 +02:00
2026-04-30 16:46:31 +02:00
2026-05-04 14:40:53 +02:00
2026-05-07 22:58:44 +02:00
2026-05-20 13:03:57 +02:00
2026-04-30 16:46:31 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:39:30 +02:00
2026-05-13 00:18:42 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-05-20 15:24:06 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-26 00:36:33 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-05-08 19:59:44 +02:00
2026-05-08 21:43:51 +02:00
2026-04-30 16:46:31 +02:00
2026-05-07 22:21:45 +02:00
2026-05-18 12:13:24 +02:00
2026-04-20 17:44:45 +02:00
2026-05-20 15:24:06 +02:00
2026-04-26 10:48:27 +02:00
2026-05-20 15:23:28 +02:00
2026-04-30 02:29:09 +02:00
2026-04-22 23:36:10 +02:00
2026-05-20 14:43:42 +02:00
2026-05-19 13:42:51 +02:00
2026-04-30 03:42:25 +02:00
2026-05-20 14:46:36 +02:00
2026-04-30 16:46:31 +02:00
2026-05-13 00:18:42 +02:00
2026-05-07 13:15:55 +02:00
2026-05-07 12:51:37 +02:00