Status: Accepted (in force). Verified 2026-07-21.
Notifications hook onto events that move through an approval lifecycle: something is created, then approved or rejected. Different audiences care about different points — approvers need the "created" signal, finance needs "approved," a manager needs "rejected." The routing model has to express which point.
Give every notification type exactly three stages — Creation, Approval, Rejection — and let a rule target one. In code, the three per-type records are addressed by composed name:
GetByName($"{notificationType.Description} Creation", companyId);
GetByName($"{notificationType.Description} Approval", companyId);
GetByName($"{notificationType.Description} Rejection", companyId);
The frontend mirrors it: STAGES = [{1,Creation},{2,Approval},{3,Rejection}], and getStageIdFromDescription parses the stage back out of the "{Type} {Stage}" string.
Good:
Bad / costs:
Description ("{Type} {Stage}"), not a clean foreign key. Renaming a type — or changing a stage keyword — can orphan records whose description no longer parses to a known stage. (runbook §4)StageId FK with no name coupling — the obvious improvement; the current name-composition looks like an early shortcut."{Type} {Stage}" naming as a contract — don't rename types/stages casually.