news_rest_api
News Rest API
Description:
A CRUD pet-project written by me as part of consolidating the knowledge gained in the course on creating applications using the Spring framework.
About project:
Backend-part of an information service in which users can create their own news and comment on the news of other users.
Technology stack:
- Java(17)
- Lombok
- Spring Framework:
- Spring WEB
- Spring JPA
- Spring Security
- Spring AOP
- Mapstruct
- Maven
- Hibernate
- PostgreSQL
- Docker
API capabilities
- create and manage users;
- create and manage news categories;
- create and manage news;
- create and manage comments for news and manage them.
Database schema
Structure
Working with data in the application is divided into 3 main levels: the controller level, the service level and the repository level.
- Controllers level: At this level of work, the validity of the data entered by the user is checked and the access rights for performing the action are checked. The necessary service level methods are also called for DTO conversion.
- Service level: At this level of work, information received from the previous level is processed, repository-level methods are called, and errors are thrown in case of abnormal application behavior.
- Repository level: At this level of work, the database is being worked on using CRUD operations.
Security
Security in this application is implemented using Spring basic auth. Some security functions are put into separate aspects and are used as annotations. The application supports three types of users: admin, moderator and user. Based on the rights granted to the user, the user can perform only those actions that are allowed to the user with this level of rights.
Docker
The application database is deployed on docker using docker-compose.yml file
Описание
A simple CRUD application for posting and commenting news
Языки
Java