This project is a Spring Boot application that serves as a backend for a final project. It provides RESTful APIs for managing projects, tasks, and users. Below is a brief overview of the main controllers in the application:
-
Projects Controller: Manages operations related to projects, including creation, retrieval, updating, and deletion. It also allows adding tasks to a project.
-
Tasks Controller: Handles tasks within projects, including retrieval, creation, updating, and deletion.
-
Users Controller: Manages user-related operations such as user registration, retrieval, updating user profile, updating password, and user deletion.
The project utilizes the following technologies and dependencies:
-
Spring Boot: The application is built using the Spring Boot framework, providing a robust and convention-over-configuration development approach.
-
Spring Data JPA: For easy interaction with the database, allowing seamless handling of data.
-
H2 Database: An in-memory database for development and testing purposes.
-
Hibernate Validator: Used for validating entities.
-
Lombok: Simplifies Java code by eliminating boilerplate code for getters, setters, constructors, etc.
-
Springfox and Springdoc: Utilized for generating and serving OpenAPI (Swagger) documentation for the RESTful APIs.
To build and run the project, ensure you have Maven installed.
mvn clean install
mvn spring-boot:run
The application will be accessible at http://localhost:8080
API documentation, powered by Swagger, can be accessed at http://localhost:8080/swagger-ui.html
and http://localhost:8080/swagger-ui/index.html?url=/v3/api-docs
Access to the H2 database console is available after running the project. You can access it via the endpoint: http://localhost:8080/h2-console
- Endpoint:
/projects/api/createProject
- HTTP Method: POST
- Summary: Create a new project with the provided details.
- Request Body: JSON representation of the project (id, name, description, beginning, ending, tasksList, users).
- Tasks and Users: Tasks and users associated with the project can be specified.
- Response: No specific response body. Project is created and saved.
- Endpoint:
/projects/api/getAllProjects
- HTTP Method: GET
- Summary: Retrieve a list of all projects.
- Response: List of projects.
- Endpoint:
/projects/api/projects/updateProjectById/{id}
- HTTP Method: PUT
- Summary: Update an existing project identified by its ID.
- Request Body: JSON representation of the updated project details.
- Response: No specific response body. Project is updated and saved.
- Endpoint:
/projects/api/projects/deleteProjectById/{id}
- HTTP Method: DELETE
- Summary: Delete an existing project identified by its ID.
- Response: No specific response body. Project is deleted.
- Endpoint:
/projects/api/projects/getProjectById/{id}
- HTTP Method: GET
- Summary: Retrieve a project by its ID.
- Response: Project details if found, otherwise returns a 404 response.
- Endpoint:
/projects/api/projects/addTaskToProject/{projectId}
- HTTP Method: POST
- Summary: Add a task to a project identified by its ID.
- Request Body: JSON representation of the task to be added.
- Response: No specific response body. Task is added to the project.
- Endpoint:
/tasks/api/projects/getTasksByProjectId/{id}
- HTTP Method: GET
- Summary: Retrieve all tasks associated with a project identified by its ID.
- Response: List of tasks.
- Endpoint:
/tasks/api/projects/{id}/tasks
- HTTP Method: POST
- Summary: Create a new task associated with a project identified by its ID.
- Request Body: JSON representation of the task details.
- Response: Created task details.
- Endpoint:
/tasks/api/projects/{id}/tasks/{taskId}
- HTTP Method: DELETE
- Summary: Delete a task identified by its ID within a project identified by its ID.
- Response: No specific response body. Task is deleted.
- Endpoint:
/tasks/api/projects/{projectId}/tasks/{taskId}
- HTTP Method: GET
- Summary: Retrieve a task by its ID within a project identified by its ID.
- Response: Task details if found, otherwise returns a 404 response.
- Endpoint:
/tasks/api/projects/{projectId}/tasks/{taskId}
- HTTP Method: PUT
- Summary: Update a task identified by its ID within a project identified by its ID.
- Request Body: JSON representation of the updated task details.
- Response: Updated task details.
- Endpoint:
/users/api/register
- HTTP Method: POST
- Summary: Register a new user with a username and password.
- Request Body: JSON representation of the user details (username, password).
- Response: Created user details.
- Endpoint:
/users/api/user/{id}
- HTTP Method: GET
- Summary: Retrieve user details by user ID.
- Response: User details if found, otherwise returns a 404 response.
- Endpoint:
/users/api/user/{id}/profile
- HTTP Method: PUT
- Summary: Update a user's username identified by its ID.
- Request Body: JSON representation of the updated user details.
- Response: Updated user details.
- Endpoint:
/users/api/user/password/{id}
- HTTP Method: PUT
- Summary: Update a user's password identified by its ID.
- Request Body: New password as a plain string.
- Response: Updated user details.
- Endpoint:
/users/api/user/{id}
- HTTP Method: DELETE
- Summary: Delete a user identified by its ID.
- Response: No specific response body. User is deleted.