feat(api): add staff order detail and compliance eligibility
This commit is contained in:
@@ -9,6 +9,7 @@ Base URL:
|
||||
## Read routes
|
||||
|
||||
- `GET /staff/orders/available`
|
||||
- `GET /staff/orders/:orderId`
|
||||
- `GET /staff/shifts/assigned`
|
||||
- `GET /staff/shifts/open`
|
||||
- `GET /staff/shifts/pending`
|
||||
@@ -80,6 +81,7 @@ Example response:
|
||||
- booking is atomic across the future shifts in that order for the selected role
|
||||
- backend returns `PENDING` when the booking is reserved but not instant-booked
|
||||
- backend returns `CONFIRMED` when every future shift in that booking path is instant-booked
|
||||
- backend returns `422 UNPROCESSABLE_ENTITY` when the worker is not eligible to book that order
|
||||
|
||||
Example request:
|
||||
|
||||
@@ -91,8 +93,44 @@ Example request:
|
||||
|
||||
Important:
|
||||
|
||||
- `roleId` for the order-booking flow is the role catalog id returned by `GET /staff/orders/available`
|
||||
- `GET /staff/orders/:orderId` is now the source of truth for the order detail screen before booking
|
||||
- `roleId` for the order-booking flow is the role catalog id returned by `GET /staff/orders/:orderId`
|
||||
- it is not the same thing as the per-shift `shift_roles.id`
|
||||
- when booking is rejected, use `details.blockers` from the error response to explain why
|
||||
|
||||
### Order detail
|
||||
|
||||
`GET /staff/orders/:orderId`
|
||||
|
||||
Use this as the source of truth for the worker order-review page before calling `POST /staff/orders/:orderId/book`.
|
||||
|
||||
Response shape includes:
|
||||
|
||||
- `orderId`
|
||||
- `orderType`
|
||||
- `roleId`
|
||||
- `roleCode`
|
||||
- `roleName`
|
||||
- `clientName`
|
||||
- `businessId`
|
||||
- `instantBook`
|
||||
- `dispatchTeam`
|
||||
- `dispatchPriority`
|
||||
- `jobDescription`
|
||||
- `instructions`
|
||||
- `status`
|
||||
- `schedule`
|
||||
- `location`
|
||||
- `pay`
|
||||
- `staffing`
|
||||
- `managers`
|
||||
- `eligibility`
|
||||
|
||||
Frontend rules:
|
||||
|
||||
- call this endpoint after a worker taps an order card from `GET /staff/orders/available`
|
||||
- use the returned `roleId` when calling `POST /staff/orders/:orderId/book`
|
||||
- if `eligibility.isEligible` is `false`, show the blocker messages and disable booking
|
||||
|
||||
### Find shifts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user