Create new trucker
POST/company/truckers/
Creates a new trucker 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 company
Automatic validations:
- Unique email in the system
- Unique taxid (DNI/NIE/CIF) and valid format
- Valid phone format
- Valid role according to model
Password management:
- If sent: Secure hash stored
- If not sent: Automatically generated and sent by email
Image management:
- Support for multipart/form-data upload
- Storage in AWS S3
imagefield contains S3 key
Welcome email:
- Automatically sent to trucker
- Includes access credentials
- Personalized with company name
- Multilingual according to user's i18n
Limits:
- Subscription plan verification (canCreateUser middleware)
- Requires multitenant permissions
Responses:
- 200 OK: Trucker 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
Trucker created successfully
Invalid data
Company not found
Email or taxid already exist
Error saving