End an associate's shift
POST/associates/:id/shift-ends
Closes the associate's shift, raising AssociateShiftEnded. Any currently active LaborAssignment is closed first (its hours logged against the shift). Idempotent: ending an already-ended shift is a no-op — no error, no event, still 204.
Request
Responses
- 204
- 400
- 404
- 409
- 500
Shift ended (or was already ended). No response body.
Response Headers
"true" when this answer is the stored replay of an earlier request with the same Idempotency-Key and fingerprint; absent on the first execution.
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).
The referenced associate has no started shift (resource-not-found).
Conflict — closing the active assignment's hours would exceed the configured max hours per shift (max-hours-exceeded), or this associate's roster entry or active assignment was concurrently modified by another request between when it was read and when this write was attempted (concurrent-modification, ADR 0021); reload and retry. Also returned (idempotency-key-reused) when the Idempotency-Key was already used with a different request (method, path or body).
Unclassified failure (e.g. a persistence or event-publish error) — internal-error.