Week XII - CompassUOL Challenge
This API provides functionality for managing user accounts, including user creation, authentication, and profile updates. Using RabbitMQ an open-source and lightweight message broker which supports multiple messaging protocols.
- Endpoint:
/v1/users - Method:
POST - Description: Creates a new user based on the provided data.
- Request:
- Body:
user(UserDTO): User data to be created
- Body:
- Responses:
201: User created successfully- Schema: UserDTO
400: Invalid request500: Internal server error
- Endpoint:
/v1/login - Method:
POST - Description: Authenticates a user based on the provided credentials.
- Request:
- Body:
loginRequest(LoginRequestDTO): Login credentials
- Body:
- Responses:
200: Login successful- Schema: LoginResponseDTO
401: Invalid credentials500: Internal server error
- Endpoint:
/v1/users/{id} - Method:
GET - Description: Retrieves information about a user based on the provided ID.
- Parameters:
id(Path Parameter): User ID (integer)
- Responses:
200: User found- Schema: UserDTO
404: User not found500: Internal server error
- Endpoint:
/v1/users/{id} - Method:
PUT - Description: Updates information about a user based on the provided ID.
- Parameters:
id(Path Parameter): User ID (integer)
- Request:
- Body:
user(UserDTO): New user data
- Body:
- Responses:
200: User updated successfully- Schema: UserDTO
404: User not found500: Internal server error
- Endpoint:
/v1/users/{id}/password - Method:
PUT - Description: Updates the password of a user based on the provided ID.
- Parameters:
id(Path Parameter): User ID (integer)
- Request:
- Body:
user(PasswordUpdateDTO): New user password
- Body:
- Responses:
200: Password updated successfully500: Internal server error
{
"type": "object",
"properties": {
"firstName": {"type": "string", "minLength": 3, "maxLength": 50},
"lastName": {"type": "string", "minLength": 3, "maxLength": 50},
"email": {"type": "string", "format": "email", "maxLength": 100},
"cpf": {"type": "string", "maxLength": 14},
"birthdate": {"type": "string", "format": "date"},
"password": {"type": "string", "minLength": 6}
}
}{
"type": "object",
"properties": {
"email": {"type": "string", "format": "email"},
"password": {"type": "string", "minLength": 6}
}
}{
"type": "object",
"properties": {
"token": {"type": "string"}
}
}{
"type": "object",
"properties": {
"password": {"type": "string", "minLength": 6}
}
}- Java 17: The programming language used for backend development.
- Spring Boot: A framework for building Java-based enterprise applications.
- Spring Security: Provides authentication and access control for the application.
- Spring Tests: Framework for testing Spring-based applications.
- MySQL: Relational database management system used for storing user data.
- MongoDB: NoSQL database used for storing notification data.
- IntelliJ: Integrated Development Environment (IDE) for Java development.
- RabbitMQ: Message broker used for communication between microservices.
To set up and run the project locally, follow these steps:
- Clone the Repository:
git clone https://github.com/Ryansousa10/SpringBoot_Challenge03_RyanSousa.git
- Install Dependencies:
Open the project in IntelliJ. Build the project to download dependencies. Configure Databases:
-
Set up MySQL and MongoDB databases and update application properties.
MySQL authentication = user: "root", password: "root".
MongoDB = NO AUTHENTICATION -
Start the application from IntelliJ or using the terminal.
-
Use your preferred API client (e.g., Postman) to make requests to the specified endpoints.
