The Assignments API exposes the employee-facing side of KaroKar’s vehicle handover model. AnDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Codefied-CodePix/Karokar-backend/llms.txt
Use this file to discover all available pages before exploring further.
Assignment record is never created directly via this API — it is produced automatically by the AssignmentService when the bookings module emits a BookingAssigned domain event (triggered by PATCH /bookings/:id/assign). This event-driven design keeps the booking and assignment modules loosely coupled: the booking module owns the approval workflow while the assignment module owns the employee acceptance lifecycle. Once an assignment exists, this API lets callers retrieve its current state and lets the assigned employee accept it.
All requests require an
Authorization: Bearer <token> header. The assignment.accept permission is required to accept an assignment; retrieval requires only a valid token.AssignmentStatus Values
An assignment moves through the following statuses during its lifecycle:| Status | Meaning |
|---|---|
PENDING | Assignment created; awaiting employee acceptance. |
ACCEPTED | Employee has accepted the vehicle handover. |
REJECTED | Employee rejected the assignment (transition not yet exposed via HTTP). |
ACTIVE | Handover is in progress (set by downstream activation). |
COMPLETED | Assignment concluded normally. |
CLOSED | Assignment closed by an administrative action. |
The
REJECTED, ACTIVE, COMPLETED, and CLOSED transitions are managed internally by the platform and are not currently exposed as HTTP endpoints.Assignment Entity Fields
EveryAssignment response object contains the following fields:
Unique identifier for the assignment, auto-generated.
UUID of the booking that triggered this assignment, or
null if the assignment was created outside the booking workflow.UUID of the vehicle being assigned to the employee.
UUID of the corporate organisation under which the assignment is made.
UUID of the employee receiving the vehicle.
Current lifecycle status of the assignment. See the status table above.
The date-time from which the assignment is effective.
The date-time at which the assignment is expected to end, or
null for open-ended assignments.Timestamp when the assignment record was created.
Timestamp of the last update to the assignment record.
GET /assignments/:id
Retrieve a single assignment by its UUID. No special permission is required beyond a valid authentication token. Required permission: nonePath Parameters
UUID of the assignment to retrieve.
Response
Returns theAssignment object if found, or null if no assignment with the given UUID exists.
Example
PATCH /assignments/:id/accept
Accept an assignment on behalf of the assigned employee, indicating that they acknowledge the vehicle handover. The caller must hold theassignment.accept permission.
Required permission: assignment.accept
This endpoint is currently wired in the controller and router but the underlying
acceptAssignment service method is marked as NotImplementedException. The endpoint will return 501 Not Implemented until the service logic is completed.Path Parameters
UUID of the assignment to accept.
Request Body
No request body required.Response
Returns the updatedAssignment object with status: "ACCEPTED" once the service implementation is complete.
Errors
| HTTP | Code | Condition |
|---|---|---|
| 403 | — | Caller lacks assignment.accept permission |
| 404 | — | Assignment not found |
| 501 | — | Service method not yet implemented |
Example
Event-Driven Creation
Assignments are not created through a direct HTTPPOST endpoint. Instead, the following sequence occurs automatically:
- A vendor operator calls
PATCH /bookings/:id/assignwith anemployeeId. - The
BookingServicetransitions the booking toASSIGNEDstatus and emits aBookingAssigneddomain event. - An event listener inside the assignments module handles the
booking.assignedevent and callsAssignmentService.createAssignment(input). - The new
Assignmentis persisted withstatus: PENDINGand theAssignmentCreatedevent is emitted.