Get the staffing gap for a path within a committed shift plan
GET/paths/:pathId/staffing-gap
Read-model projection: plannedHeads (from the committed ShiftPlan for siteCode+shiftId) vs. currently active LaborAssignment count for pathId. Raises PathUnderstaffed when active assignments fall short of plannedHeads. This surfaces the gap only — it never decides or performs a rebalance; that stays a human call recorded via POST /associates/{id}/assignments. ShiftPlan is keyed by site+shift, so both are needed as query parameters alongside the path in the URL — a path's planned heads only make sense within one committed plan. siteCode is the canonical name (ADR 0035): it is the plan lookup key AND the associate scope (activeHeads counts only associates with an active shift at that site, ADR 0034). buildingId is the DEPRECATED alias for the plan lookup ONLY: a call that gives just buildingId is NOT scoped by site and counts fleet-wide, exactly as before. One of the two is required (neither is 400 missing-building-id). When both are given, buildingId is the plan key and siteCode the scope, as ADR 0034 defined.
Request
Responses
- 200
- 400
- 404
- 500
Staffing gap for this path within the committed plan.
Malformed JSON body, or a required field was missing/empty (empty-associate-id, empty-path-id, empty-certification, missing-building-id -- neither siteCode nor its deprecated alias buildingId was sent --, missing-shift-id, missing-charge, unknown-path-id -- a pathId the process-path catalogue does not declare --, or malformed-request-body). The two staffing-gap list routes also answer 400 for a bad paging query: invalid-limit (not an integer 1-500, empty or repeated), invalid-cursor (undecodable or repeated) and unknown-query-parameter (any query parameter other than limit, cursor and, on the deprecated route, siteCode). On every POST a missing Idempotency-Key header is also a 400 (idempotency-key-required) and a malformed one (not 1-128 printable ASCII starting and ending with a visible character) a 400 (idempotency-key-invalid).
No committed ShiftPlan exists for siteCode (or buildingId) + shiftId (resource-not-found).
Unclassified failure (e.g. a persistence or event-publish error) — internal-error.