This project implements a RESTful API for managing users. It is built using Spring Boot and follows best practices for RESTful API design.
This project aims to provide a comprehensive RESTful API for user management. It includes endpoints for creating, updating, deleting users, as well as searching users by birth date range.
The requirements for this project include:
- Implementation of a RESTful API for user management.
- Validation for user fields such as email pattern, age, and birthdate range.
- Search for users by birthdate range.
- Unit tests using Spring.
- Error handling for REST.
- Responses in JSON format.
- Use of Spring Boot.
- Optional: Use database for data persistence.
The API is implemented using Spring Boot, following RESTful API best practices. It includes controllers for user management, services for business logic, and repositories for data access. Unit tests are written using Spring's testing framework to ensure code coverage and reliability.
To run the application, follow these steps:
- Clone the repository.
- Open the project in your preferred IDE.
- Build the project using Maven.
- Run the application as a Spring Boot application.
The following endpoints are available:
POST /auth/register
: Create/registration a new user.PATCH /users/{id}/name
: Update a user's firstname and lastname.PATCH /users/{id}/address
: Update a user's address.PATCH /users/{id}/phone
: Update a user's phone number.PUT /users/{id}
: Update a user's fields without address.DELETE /users/{id}
: Delete (soft delete) a user.GET /users/birth-range
: Search for users by birthdate range.
Unit and integration tests are written to cover all implemented functionality. These tests ensure the reliability and correctness of the codebase.
Error handling is implemented to provide meaningful error responses for RESTful API requests. Exceptions are caught and appropriate HTTP status codes and error messages are returned to the client.
API responses are formatted in JSON to ensure compatibility with modern web applications and ease of parsing.
- Java
- Spring Boot
- Spring MVC
- Spring Data JPA
- H2 Database
- Liquibase
- Lombok
- Mockito
- Maven
This project was implemented by Denis Kaliakin. I want to thank you for the opportunity to implement this task.