Skip to main content

Staffing

Read model surfacing the gap between a path's committed plannedHeads and its currently active assignments.

📄️Get the staffing gap for a path within a committed shift plan

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.

📄️List the staffing gap for every path planned within one committed shift plan of a site (canonical route)

The canonical route of the all-paths staffing-gap list (ADR 0035; supersedes GET /buildings/{buildingId}/shifts/{shiftId}/staffing-gap, which stays as a deprecated alias). Same handler core and response shape. The path siteCode is both the plan lookup key and the associate scope: every path's activeHeads counts only associates with an active shift at that site (ADR 0034). Reuses the exact same per-path computation as GET /paths/{pathId}/staffing-gap and raises PathUnderstaffed for every understaffed path in the plan. This surfaces the gaps only — it never decides or performs a rebalance; that stays a human call recorded via POST /associates/{id}/assignments.

📄️DEPRECATED -- use GET /sites/{siteCode}/shifts/{shiftId}/staffing-gap. List the staffing gap for every path planned within one committed shift plan (fleet-wide, all-paths view)

DEPRECATED alias of GET /sites/{siteCode}/shifts/{shiftId}/staffing-gap (ADR 0035): buildingId is the legacy name of the plan key. Every response carries the header `Deprecation: true`. It keeps working, unchanged, until a later breaking ADR removes it; a call that gives only the buildingId path segment is NOT scoped by site.