shifts
Crew module · 8 operations
List shift rows
GET/shifts
A staffed crew block. A shift cannot end before it starts. Returns a cursor page of shift rows the caller may see. The default order is `starts_at` ascending. Supports sparse fieldsets and the filter grammar.
Create a shift
POST/shifts
A staffed crew block. A shift cannot end before it starts. Creates a shift. Requires `Idempotency-Key`; a replay returns the original response. The organization is derived from the credential or the parent row, never from the body.
Get a shift
GET/shifts/{id}
A staffed crew block. A shift cannot end before it starts. Returns one shift with its `ETag`. A shift the caller may not see returns 404.
Update a shift
PATCH/shifts/{id}
A staffed crew block. A shift cannot end before it starts. Updates the fields sent; omitted fields are unchanged. Requires `If-Match` with the current `ETag`: a stale tag returns 412 and a missing tag returns 428.
Delete a shift
DELETE/shifts/{id}
A staffed crew block. A shift cannot end before it starts. Soft-deletes the shift: it moves to Trash and can be restored for its table's retention period.
Transition the shift state
POST/shifts/{id}/transitions
Moves the shift lifecycle to another state through its transition RPC, which writes the transition ledger. Uses compare-and-set on `expected_state`; a disallowed transition returns a 422 refusal. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
Accept a shift
POST/shifts/{id}/accept
Accepts the shift as the assigned person. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
Claim an open shift
POST/shifts/{id}/claim
Claims a published shift that has no one on it for the caller's own membership, under the project's claiming rule (scheduling.open_shift_claiming). Under first-come the caller gets the shift at once: it becomes Accepted and `claim` is null. Under approval, the default, or seniority the claim waits for a supervisor: the shift stays Published with no one on it and `claim` carries the waiting claim. A second claim on the shift while the caller's first one waits is refused (422, shift_claim_waiting). A held, unpublished or overlapping shift is refused (422). Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.