All assignment endpoints are protected. Requests must include a valid JWT and the authenticated user must have the
admin role.Business rules
- A vehicle may not have more than one
activeassignment simultaneously. - A technician may not have more than one
activeassignment simultaneously. - Use the return endpoint to mark an assignment as
returnedbefore creating a new one.
List assignments
GET /api/admin/assignments
Returns all assignments ordered by assigned date (newest first), each including the assigned vehicle and technician.
Query parameters
Filter by assignment status. One of
active or returned. If omitted, all assignments are returned.Response
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
Create assignment
POST /api/admin/assignments
Assigns a vehicle to a technician. Both must be free of any existing active assignment.
Request body
ID of the vehicle to assign.
ID of the technician to assign.
Response
Returns201 Created with the new assignment object.
Errors
| Status | Description |
|---|---|
400 | Validation failed — vehicleId or technicianId missing. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
409 | The vehicle or technician already has an active assignment. |
500 | Internal server error. |
Return assignment
PATCH /api/admin/assignments/:id/return
Marks an assignment as returned, releasing both the vehicle and technician for new assignments.
Path parameters
The assignment ID.
Response
Returns200 OK with the updated assignment object.
Updated assignment with
status set to returned.Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Assignment not found. |
409 | Assignment is already returned. |
500 | Internal server error. |