Update trucker
PUT/company/truckers/:id
Updates data of an existing trucker.
Update process:
- Company membership verification
- Email change validation (uniqueness)
- Data validation according to model
- Image management (upload/deletion in S3)
- Saving changes
Special validations:
- If email is changed, verify no other user has that email
- Changing to existing email not allowed
- Previous image is deleted from S3 if new one uploaded or deleted
Image management:
- New image: Uploaded to S3 and previous one deleted
- No image in body: Deleted from S3 and set to null
- Existing image unchanged: Kept
Editable fields:
- name, lastname, email, phone, taxid
- default_vehicle, allowSearch
- image (via multipart)
- address (complete object)
Responses:
- 200 OK: Trucker updated
- 400 Bad Request: Invalid data
- 403 Forbidden: Doesn't belong to company
- 404 Not Found: Trucker not found
- 406 Not Acceptable: Email already exists
Request
Responses
- 200
- 400
- 403
- 404
- 406
Trucker updated
Invalid data
Doesn't belong to company
Trucker not found
Email already exists