Skip to main content

Update trucker

PUT 

/company/truckers/:id

Updates data of an existing trucker.

Update process:

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

Trucker updated