Create new trucker
POST/company/truckers/
Create a new carrier associated with the authenticated user's company.
Creation Process:
- Validation of mandatory data (email, taxid)
- Uniqueness verification (unique email and taxid)
- Automatic password generation (if not provided)
- Secure password hashing
- Profile image upload to S3 (optional)
- Email sending with credentials
- Automatic association to the company
Automatic Validations:
- Unique email in the system
- Unique taxid (DNI/NIE/CIF) with valid format
- Phone number with valid format
- Valid role according to model
Password Management:
- If sent: Secure hash is stored
- If not sent: Automatically generated and sent via email
Image Management:
- Support for multipart/form-data upload
- Storage in AWS S3
imagefield contains the S3 key
Welcome Email:
- Automatically sent to the carrier
- Includes access credentials
- Personalized with company name
- Multi-language based on user i18n
Limits:
- Subscription plan verification (middleware canCreateUser)
- Requires multitenant permissions
Responses:
- 200 OK: Carrier created successfully
- 400 Bad Request: Invalid data or missing information
- 401 Unauthorized: Company not found
- 406 Not Acceptable: Email or taxid already exist
- 503 Service Unavailable: Error saving to database
Request
Responses
- 200
- 400
- 401
- 406
- 503
Carrier created successfully
Invalid data
Company not found
Email or tax ID already exist
Error saving