Repair Workflow API

Work-Order Status Flow

open -> processing -> completed -> confirmed

Status

Description

open

Pending; newly created work order

processing

In progress; an administrator has taken over

completed

Completed; waiting for requester confirmation

confirmed

Confirmed; workflow finished

1. Standard Repair Request (All Authenticated Users)

POST /api/v1/repairs

Body:

{
  "classroom_id": 121,
  "description": "The projector cannot be powered on.",
  "images": ["url1", "url2"]
}

Restriction:

  • Duplicate submissions are prohibited when the same classroom has a work order with open or processing status.

2. Emergency Repair

POST /api/v1/repairs/emergency

Body: same as a standard repair request.

Returns:

  • Phone number of the assistant on duty.

  • A work order is created at the same time.

3. Work-Order List

GET /api/v1/repairs

Permissions:

  • assistant / superadmin / counselor: view all work orders.

  • Other roles: view only work orders they created.

4. Update Work Order (assistant / superadmin / counselor)

PUT /api/v1/repairs/{id}

Body:

{
  "status": "processing",
  "remark": "Processing notes"
}

Notes:

  • remark is optional.

  • The current user is automatically set as the processor during update.

5. Requester Confirms Repair Completion

PUT /api/v1/repairs/{id}/confirm

Permission: only the work-order creator may call this endpoint.

Notes: changes the work-order status from completed to confirmed.