Skip to main content

Update trucker

PUT 

/company/truckers/:id

Updates the data of an existing carrier.

Update Process:

  1. Company membership verification
  2. Email change validation (uniqueness)
  3. Data validation according to the model
  4. Image management (upload/delete in S3)
  5. 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

Carrier updated