Skip to main content

Delete trucker

DELETE 

/company/truckers/:id

Removes a carrier from the company using soft delete.

Deletion process:

  1. Verification of company membership
  2. Deletion of profile image in S3 (if it exists)
  3. Soft delete of the record (mongoose-delete)
  4. The record is marked as deleted but remains in the database

Important considerations:

  • It is a logical deletion (soft delete), not a physical one
  • The image is permanently deleted from S3
  • The carrier can be restored if necessary
  • References in deliveries/auctions are maintained

Security:

  • Can only delete carriers from their own company
  • Automatic membership verification

Responses:

  • 200 OK: Carrier deleted (returns {_id})
  • 403 Forbidden: Does not belong to the company
  • 404 Not Found: Carrier not found

Warning: The current code marks this operation as dangerous. Review impact on deliveries and auctions before deleting.

Request

Responses

Carrier successfully removed.