Shop It Docs
Developer Resourcesrepair

Repair Requests API Guide

Repair Requests API contracts for customer and admin surfaces.

Repair Requests — API & Integration Guide

1. Quick Reference

  • Module: RepairRequests
  • Customer auth: JwtAuthGuard (global APP_GUARD — no explicit guard on customer controller)
  • Admin auth: JwtAuthGuard + RoleGuard + @Permissions(...)
  • Customer base path: /api/repair-requests
  • Admin base path: /api/admin/repair-requests
  • Admin identifier: internal integer id (not publicId)
  • Success envelope: ResponseDto<T>

2. Route Summary

2.1 Customer

MethodPathDescription
POST/api/repair-requestsCreate repair request
GET/api/repair-requestsList own repair requests (paginated)
GET/api/repair-requests/:publicIdGet single repair request by public ID
PATCH/api/repair-requests/:publicId/cancelCancel repair request

Customer cancel is allowed only when status = request_received. Any other status returns 422 REPAIR_REQUEST_CANNOT_CANCEL.

2.2 Admin

MethodPathPermission
GET/api/admin/repair-requestsRepairRequests_READ
GET/api/admin/repair-requests/:idRepairRequests_READ
PATCH/api/admin/repair-requests/:id/statusRepairRequests_UPDATE
PATCH/api/admin/repair-requests/:id/collection-methodRepairRequests_UPDATE
PATCH/api/admin/repair-requests/:id/notesRepairRequests_UPDATE

3. Request / Response Shapes

3.1 Create repair request

  • POST /api/repair-requests
  • Request body:
{
  "devices": [
    {
      "brandId": 3,
      "laptopModel": "HP Pavilion 15",
      "problemDescription": "Screen flickering and battery drain"
    }
  ],
  "collectionMethod": "pickup",
  "sourceType": "direct_booking",
  "sharedDescription": "All devices have the same issue."
}
  • brandId OR customBrandName must be provided per device (not both, not neither).
  • orderId is optional — links the repair to an existing order.
  • orderItemId is optional per device — links device to an order line item.
  • Minimum 1 device required.

3.2 Admin filter query params

  • GET /api/admin/repair-requests?status=under_repair&userId=uuid&dateFrom=2026-06-01&dateTo=2026-06-30&search=TR-&page=1&size=20
ParamTypeDescription
statusRepairStatus enumFilter by current status
userIdUUID stringFilter by customer UUID
dateFromISO date stringTickets created on or after this date
dateToISO date stringTickets created on or before this date (inclusive)
searchstringILIKE match on ticket number
pagenumberPage number (default: 1)
sizenumberPage size (default: 20)

3.3 Update status

  • PATCH /api/admin/repair-requests/:id/status
  • Request body:
{
  "status": "picked_up",
  "notes": "Picked up at 10:30 AM from customer.",
  "estimatedDeliveryAt": "2026-06-25T18:00:00.000Z"
}
  • notes and estimatedDeliveryAt are optional.
  • Triggers a push notification to the customer.

3.4 Update collection method

  • PATCH /api/admin/repair-requests/:id/collection-method
  • Request body:
{
  "collectionMethod": "dropoff"
}

3.5 Update admin notes

  • PATCH /api/admin/repair-requests/:id/notes
  • Request body:
{
  "adminNotes": "Customer confirmed pickup window: 9 AM–12 PM."
}

4. Error Reference

CodeHTTPDescription
REPAIR_REQUEST_NOT_FOUND404Repair request not found by ID or publicId
REPAIR_REQUEST_NOT_OWNED403Customer attempted to access another user's ticket
REPAIR_REQUEST_CANNOT_CANCEL422Cancel attempted when status is not request_received
REPAIR_REQUEST_INVALID_STATUS_TRANSITION400Admin attempted an invalid status transition
REPAIR_REQUEST_ORDER_NOT_FOUND404Linked order ID does not exist
REPAIR_REQUEST_ORDER_NOT_OWNED403Linked order ID belongs to another customer
REPAIR_REQUEST_DEVICE_BRAND_REQUIRED422Device has neither brandId nor customBrandName
REPAIR_REQUEST_NO_DEVICES422Create request submitted with zero devices
REPAIR_REQUEST_CREATE_FAILED500Ticket number generation or DB write failed
REPAIR_REQUEST_ORDER_ITEM_NOT_IN_ORDER422Device's orderItemId does not belong to the linked order

5. Integration Notes

  • Repair requests are free of charge — no payment step.
  • Guest users save partial form state in localStorage; after login they are redirected with pre-filled data but do not carry a backend session.
  • No duplicate ticket prevention — the same customer may submit multiple tickets for the same device.
  • publicId is a UUID7 identifier, used in all customer-facing routes.
  • Internal id (serial integer) is used in admin routes.
  • Push notifications fire asynchronously after every status transition set by admin (fire-and-forget with void).