Skip to content

A simple CRUD application for posting and commenting news

Notifications You must be signed in to change notification settings

MVTrofimov/news_rest_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News Rest API

java spring PostgreSQL hibernate docker maven


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

img_2.png


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

About

A simple CRUD application for posting and commenting news

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages