What an assignment is
An assignment record ties one technician (a user with thetechnician role) to one vehicle. It has two possible statuses:
| Status | Meaning |
|---|---|
active | The technician is currently assigned to the vehicle |
returned | The assignment has been closed; the vehicle and technician are available again |
assignedDate is recorded automatically when the assignment is created.
Business rules
The system enforces two hard constraints when creating an assignment:One active assignment per vehicle
A vehicle can only have one active assignment at a time. Attempting to assign a vehicle that already has an active assignment returns a
409 Conflict error.One active assignment per technician
A technician can only have one active vehicle assignment at a time. Attempting to assign a technician who is already assigned to another vehicle returns a
409 Conflict error.Creating an assignment
Assignments are created via the backend API. Send aPOST request to the assignments endpoint with the following body:
- The vehicle exists.
- The user exists and has the
technicianrole. - Neither the vehicle nor the technician has an existing active assignment.
201 Created and the new assignment object, with status set to "active".
The assignment endpoint is protected by admin authentication. Ensure your request includes a valid Bearer token obtained from the login endpoint.
Returning an assignment
To close an active assignment, send aPATCH request to the return endpoint:
status to "returned". The vehicle and technician are now free to be assigned again.
If the assignment is already in returned status, the request is idempotent — the record is returned unchanged with no error.
Returning an assignment does not delete the record. The full assignment history is preserved and remains queryable.
Filtering assignments by status
The list endpoint supports filtering by status via a query parameter:- Active assignments
- Returned assignments
- All assignments
id, name, and email.
Dashboard visibility
The number of currently active assignments is shown on the backend dashboard endpoint undersummary.activeAssignments. This count updates in real time as assignments are created and returned.