Shifts
Shift Management
The shift endpoints allow you to manage the work schedules of the restaurant staff.
-
GET /shifts: Gets all the shifts in the system.- Authorization: Requires
shifts_read - cURL Example:
curl -X GET "http://127.0.0.1:9154/shifts" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Cookie: refreshToken=$REFRESH_TOKEN"- Response Body (Success - 200 OK):
[{"id": "670ee547-bc75-4c02-89ff-2cd45f12c77f","user_id": "f9c9d4fc-c4b7-4c42-8ae3-bb4649b34f2b","shift_date": "1753523565371","start_time": "1753523565371","end_time": "1753549837824","notes": "Morning shift"},{"id": "c145e48c-210e-49fd-b2fd-3b8fbaf76529","user_id": "b3ddbf81-7934-49ed-b495-086f8c5eda93","shift_date": "1753523565371","start_time": "1753523565371","end_time": null,"notes": "Afternoon shift - In progress"}]- Response Body (No Content - 204 No Content):
"No shifts found" - Authorization: Requires
-
GET /shifts/{id}: Gets a specific shift by its ID.- Authorization: Requires
shifts_read - Path Parameters:
id(string): ID of the shift to get
- cURL Example:
curl -X GET "http://127.0.0.1:9154/shifts/0e5805f1-ff25-4c9d-823b-cacc81eb31db" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Cookie: refreshToken=$REFRESH_TOKEN"- Response Body (Success - 200 OK):
{"id": "0e5805f1-ff25-4c9d-823b-cacc81eb31db","user_id": "ac5f7527-3c9a-4d89-9133-ee5d8fde631e","shift_date": "1753523565371","start_time": "1753523565371","end_time": "1753549837824","notes": "Morning shift"} - Authorization: Requires
-
GET /shifts/open: Gets the currently open shift.- Authorization: Requires
shifts_read - Query Parameters:
user_id(string, optional): Filter by specific user
- cURL Example:
curl -X GET "http://127.0.0.1:9154/shifts/open?user_id=ac5f7527-3c9a-4d89-9133-ee5d8fde631e" \-H "Cookie: accessToken=$ACCESS_TOKEN"- Response Body (Success - 200 OK):
Shiftobject of the open shift - Response Body (No open shift - 204 No Content)
- Authorization: Requires
-
POST /shifts: Creates a new shift.- Authorization: Requires
shifts_create - Request Body:
{"user_id": "string","shift_date": "Unix Timestamp","start_time": "Unix Timestamp","end_time": "Unix Timestamp (optional)","notes": "string","initial_amount": 0.0}- cURL Example:
curl -X POST "http://127.0.0.1:9154/shifts" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Content-Type: application/json" \-d '{"user_id": "ac5f7527-3c9a-4d89-9133-ee5d8fde631e","shift_date": "1753523565371","start_time": "1753523565371","notes": "Morning shift","initial_amount": 500.00}'- Response Body (Success - 201 Created):
{"id": "3bbaee46-57f7-461b-9df5-bd40c61823ee","message": "Shift added successfully"} - Authorization: Requires
-
PUT /shifts/{id}: Updates an existing shift.- Authorization: Requires
shifts_update - Path Parameters:
id(string): ID of the shift to update
- Request Body:
{"user_id": "string","shift_date": "Unix Timestamp","start_time": "Unix Timestamp","end_time": "Unix Timestamp (optional)","notes": "string","initial_amount": 0.0,"final_amount": 0.0,"difference": 0.0}- cURL Example:
curl -X PUT "http://127.0.0.1:9154/shifts/0e5805f1-ff25-4c9d-823b-cacc81eb31db" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Content-Type: application/json" \-d '{"user_id": "03978988-42ff-4cb9-a790-c51aceb39b2b","shift_date": "1753523565371","start_time": "1753523565371","end_time": "1753549837824","notes": "Shift extended for special events","initial_amount": 500.00}'- Response Body (Success - 200 OK):
{"id": "0e5805f1-ff25-4c9d-823b-cacc81eb31db","message": "Shift updated successfully"} - Authorization: Requires
-
POST /shifts/{id}/close: Closes an open shift.- Authorization: Requires
shifts_create - Path Parameters:
id(string): ID of the shift to close
- Request Body (optional):
{"final_amount": 520.00,"difference": 20.00}- cURL Example:
curl -X POST "http://127.0.0.1:9154/shifts/0e5805f1-ff25-4c9d-823b-cacc81eb31db/close" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Content-Type: application/json" \-d '{ "final_amount": 520.00, "difference": 20.00 }'- Response Body (Success - 200 OK):
{"id": "0e5805f1-ff25-4c9d-823b-cacc81eb31db","message": "Shift closed successfully"} - Authorization: Requires
-
DELETE /shifts/{id}: Deletes a shift from the system.- Authorization: Requires
shifts_delete - Path Parameters:
id(string): ID of the shift to delete
- cURL Example:
curl -X DELETE "http://127.0.0.1:9154/shifts/03978988-42ff-4cb9-a790-c51aceb39b2b" \-H "Cookie: accessToken=$ACCESS_TOKEN" \-H "Cookie: refreshToken=$REFRESH_TOKEN"- Response (Success - 204 No Content): no body
- Authorization: Requires
Important notes:
- All shift endpoints require authentication except for GET, which is required when starting a session
- Shift IDs are automatically generated UUIDs
- A shift must be associated with a valid user (
user_id) - The
end_timefield can benullfor ongoing shifts - The
notesfield is optional and can contain additional information - There can be no overlapping shifts for the same user on the same date