Delete trucker
DELETE/company/truckers/:id
Removes a carrier from the company using soft delete.
Deletion process:
- Verification of company membership
- Deletion of profile image in S3 (if it exists)
- Soft delete of the record (mongoose-delete)
- 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
- 200
- 403
- 404
Carrier successfully removed.
It does not belong to the company.
Carrier not found