Update trucker
PUT/company/truckers/:id
Updates the data of an existing carrier.
Update Process:
- Company membership verification
- Email change validation (uniqueness)
- Data validation according to the model
- Image management (upload/delete in S3)
- Saving of changes
Special Validations:
- If the email is changed, it is verified that no other user has that email
- Changing to an already existing email is not allowed
- The previous image is deleted from S3 if a new one is uploaded or if it is removed
Image Management:
- New image: Uploaded to S3 and the previous one is deleted
- No image in body: Deleted from S3 and set to null
- Existing image without changes: It is kept
Editable Fields:
- name, lastname, email, phone, taxid
- default_vehicle, allowSearch
- image (via multipart)
- address (complete object)
Responses:
- 200 OK: Carrier updated
- 400 Bad Request: Invalid data
- 403 Forbidden: Does not belong to the company
- 404 Not Found: Carrier not found
- 406 Not Acceptable: Email already exists
Request
Responses
- 200
- 400
- 403
- 404
- 406
Carrier updated
Invalid data
It does not belong to the company.
Carrier not found
Email already exists