The application is implemented to simulate websites such as blogs. It provides the ability to register and log in, along with the underlying String Security system. Users on the website can add new posts, edit ONLY their own posts (with the exception of the admin account), delete ONLY their own posts, and sort posts by creation date, popularity, and post rating. Posts can also be filtered by types such as SPORT, MUSIC, EDUCATION, and OTHER, as well as by searching for a post by its title. Users can also track the average rating of a specific post, as well as rate posts and edit their post ratings. There is also a "Settings" section on each user's account that allows for language changes.
• Java 17
• Spring Boot 6
• Spring Security 6
• PostgreSQL
• Tomcat
• IntelliJ IDEA
• Hibernate
• Maven
• Lombok
• JUnit 5
• JWT token
• React JS
• CSS
• Authenticate - provided with Spring Security - Registration, Login and Logout.
• Post Management - get, create, update, delete operations on posts dependent on the role that a particular user has. Sorting posts by: creation date, popularity and rating. Filter posts by type: SPORT, MUSIC, EDUCATION, OTHER and also by title of the post.
• Rating Post Management - get, create, update operations on posts rating dependent on the role that a particular user has.
+---src
| +---main
| | +---java
| | | \---pl
| | | \---maciejklonicki
| | | \---ytapp
| | | | WebServiceApplication.java
| | | |
| | | +---auditing
| | | | ApplicationAuditAware.java
| | | |
| | | +---auth
| | | | | AuthAccessDeniedHandler.java
| | | | | AuthenticationController.java
| | | | | AuthenticationRequest.java
| | | | | AuthenticationResponse.java
| | | | | AuthenticationService.java
| | | | | RegisterRequest.java
| | | | |
| | | | \---exception
| | | | PasswordMismatchException.java
| | | |
| | | +---config
| | | | | ApplicationConfig.java
| | | | | JwtAuthenticationFilter.java
| | | | | JwtService.java
| | | | | LogoutService.java
| | | | | SecurityConfig.java
| | | | |
| | | | \---exception
| | | | LogoutException.java
| | | |
| | | +---postrating
| | | | | PostRating.java
| | | | | PostRatingController.java
| | | | | PostRatingRepository.java
| | | | | PostRatingService.java
| | | | | PostRatingServiceImpl.java
| | | | |
| | | | +---dto
| | | | | EditPostRatingRequest.java
| | | | | RatePostRequest.java
| | | | |
| | | | \---exception
| | | | PostAlreadyRatedAdvice.java
| | | | PostAlreadyRatedException.java
| | | | PostRatingNotFoundAdvice.java
| | | | PostRatingNotFoundException.java
| | | |
| | | +---posts
| | | | | Post.java
| | | | | PostController.java
| | | | | PostRepository.java
| | | | | PostService.java
| | | | | PostServiceImpl.java
| | | | | PostType.java
| | | | |
| | | | +---dto
| | | | | CreatePostDTO.java
| | | | | GetAllPostsDTO.java
| | | | | SinglePostDTO.java
| | | | | UpdatePostDTO.java
| | | | |
| | | | \---exception
| | | | PostNotFoundAdvice.java
| | | | PostNotFoundException.java
| | | | PostTitleAlreadyExistsAdvice.java
| | | | PostTitleAlreadyExistsException.java
| | | | UnauthorizedAdvice.java
| | | | UnauthorizedException.java
| | | |
| | | +---token
| | | | Token.java
| | | | TokenRepository.java
| | | | TokenType.java
| | | |
| | | \---users
| | | | Role.java
| | | | UserRepository.java
| | | | Users.java
| | | |
| | | \---exception
| | | UsersEmailAlreadyExistsAdvice.java
| | | UsersEmailAlreadyExistsException.java
| | | UsersNotFoundAdvice.java
| | | UsersNotFoundException.java
| | |
| | \---resources
| | application-dev.properties
| | application.properties
| |
| \---test
| \---java
| \---pl
| \---maciejklonicki
| \---ytapp
| | WebServiceApplicationTests.java
| |
| +---auth
| | AuthenticationServiceTest.java
| |
| +---postrating
| | PostRatingServiceImplTest.java
| |
| \---posts
| PostServiceImplTest.java
+---public
| \---locales
| +---en
| | translation.json
| |
| \---pl
| translation.json
|
\---src
| App.js
| App.test.js
| i18next.js
| index.css
| index.js
| logo.svg
| reportWebVitals.js
| setupTests.js
|
\---components
| NavigationBar.js
| NotFound.css
| NotFound.js
|
+---posts
| Body.js
| CreatePost.js
| EditPost.js
| EditPostRating.js
| PostDetails.js
| RatingBox.js
|
+---service
| PostService.js
|
+---settings
| Settings.css
| Settings.js
|
\---user
Login.js
Registration.js
Method | URL | Description | Sample body |
---|---|---|---|
POST | /api/v1/auth/register | Sign up | JSON |
POST | /api/v1/auth/authenticate | Sign in | JSON |
POST | /api/v1/auth/logout | Logout | JSON |
Method | URL | Description | Sample body |
---|---|---|---|
GET | /api/v1/posts | Get all posts | JSON |
GET | /api/v1/posts/{id} | Get single post | JSON |
GET | /api/v1/posts/user/{username} | Get user posts | JSON |
GET | /api/v1/posts/sorted-desc-by-popularity | Sort post descending by popularity | JSON |
GET | /api/v1/posts/sorted-desc-by-creation-date | Sort post descending by creation date | JSON |
GET | /api/v1/posts/sorted-desc-by-rating | Sort post descending by rating | JSON |
GET | /api/v1/posts/sorted-asc-by-popularity | Sort post ascending by popularity | JSON |
GET | /api/v1/posts/sorted-asc-by-creation-date | Sort post ascending by creation date | JSON |
GET | /api/v1/posts/sorted-asc-by-rating | Sort post ascending by rating | JSON |
GET | /api/v1/posts/{postId}/average-rating | Get post average rating | JSON |
POST | /api/v1/posts | Create new post | JSON |
DELETE | /api/v1/posts/{id} | Delete post | JSON |
PUT | /api/v1/posts/update/{id} | Update post | JSON |
PUT | /api/v1/posts/{id}/increment-popularity" | Increment post popularity | JSON |
Method | URL | Description | Sample body |
---|---|---|---|
GET | /api/v1/post-ratings/get-rating | Get post rating | JSON |
POST | /api/v1/post-ratings/rate | Add post rating | JSON |
PUT | /api/v1/post-ratings/edit-rating | Edit post rating | JSON |
{
"username": "STRING",
"email": "STRING",
"password": "STRING",
"confirmPassword": "STRING",
"mobile": "STRING"
}
{
"username": "STRING",
"password": "STRING"
}
{
Logout successful!
}
[
{
"id": LONG,
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING"
}
Authorization -> Bearer Token
[
{
"id": LONG,
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
[
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []",
"popularity": 0,
"totalRatings": 0
}
]
DOUBLE
Authorization -> Bearer Token
{
"title": "STRING",
"body": "STRING",
"author": "STRING",
"type": "STRING",
"creationDate": "DATE",
"photo": "BYTE []"
}
Authorization -> Bearer Token
Delete successful!
Authorization -> Bearer Token
{
"title": "STRING",
"body": "STRING",
"type": "STRING"
}
Implemented!
{
"id": LONG,
"rating": INT
}
Authorization -> Bearer Token
You rated post successfuly!
Authorization -> Bearer Token
You have changed the rate of the post successfuly!