Endpoint
Description
Creates a new user account in the system with notification preferences. The user can be configured to receive email and/or push notifications.Authentication
This endpoint may require authentication depending on your system configuration.Request Body
The full name of the user.Example:
John DoeValidation: Must be a non-empty stringThe email address of the user.Example:
[email protected]Validation: Must be a valid email address formatFirebase Cloud Messaging (FCM) token for push notifications.Example:
fcm_token_string_exampleNote: Optional - provide this if the user wants to receive push notificationsUser notification preferences.Example:
{"email": true, "push": false}User password for authentication.Note: This field is required for user account creation. Ensure proper password hashing is implemented server-side.
Response
Unique identifier assigned to the newly created userExample:
123e4567-e89b-12d3-a456-426614174000Full name of the userExample:
John DoeEmail address of the userExample:
[email protected]Firebase Cloud Messaging tokenExample:
fcm_token_string_exampleUser notification preferencesExample:
{"email": true, "push": false}Timestamp when the user was createdExample:
2024-03-15T10:30:00.000ZError Responses
Returned when the request payload is invalid.Example scenarios:
- Invalid email format
- Missing required fields
- Email already exists
Returned when a user with the specified email already exists.
Example Request
Example Response
201 Created
Notes
- User preferences are stored in PostgreSQL and cached in Redis for quick access
- The
push_tokenis required if the user wants to receive push notifications - Email uniqueness is enforced at the database level
- Passwords are hashed before storage (never stored in plain text)
- After creation, the user can receive notifications based on their preferences
- The User Service validates all fields using NestJS validation pipes