The idea behind our project is to create a forum-style platform that allows users to post blogs within a feed in the form of written words with the option to add media and/or images.
The chatroom element comes into play when adding the comments feature to posts where users can interact with each other regarding various topics of interest or themes.
Users can post to their blog and also view posts from other creators.
Users can also like each other’s posts; each post can be liked once and the likes increment as more people like it.
One relevant example of a platform that has developed a similar concept is Substack.
Tech Stack:
- Install PostgreSQL, Postico, Postman, and an IDE that supports Java.
- In your terminal, navigate to the directory you want to clone the repository into and then clone the repository.
- In your terminal create a PostgreSQL database using the command:
createdb Blog_API
- Then run the application and use Postman and Postico to run endpoints and view changes in the database.
ERD Diagram: https://github.com/sabaki4/Personal_Blog/blob/main/Project_ERD.png
UML Diagram: https://github.com/sabaki4/Personal_Blog/blob/main/FinalDiagrams.png
Created:
- UML diagram and Entity Relationship Diagram.
- Relevant packages: components, models, controllers, services, repositories for User, Blog, Post, and Comment.
- A Data loader within the components package.
- Models: relationship annotations, creating tables, getters and setters.
- Repositories as interfaces.
- DTOs in the model for each entity.
- Controllers and services simultaneously.
URL | Method | Description | Request Body | |
---|---|---|---|---|
INDEX | /blogs | GET | Returns a list of all blogs | |
CREATE | /blogs | POST | Creates a new blog | {"name" : "Adam", "dateOfCreation" : "12/12/2001, "timeOfCreation" : "12:00", "userId" : 3} |
SHOW | /blogs/:id | GET | Returns details of one specific blog | |
UPDATE | /blogs/:id | PUT | Updates a specific blog | {"name" : "BLOG", "dateOfCreation" : "12/12/2024, "timeOfCreation" : "Tomorrow"} |
DELETE | /blogs/:id | DELETE | Deletes a specific blog |
URL | Method | Description | Request Body | |
---|---|---|---|---|
INDEX | /posts | GET | Returns a list of all posts | |
CREATE | /posts | POST | Creates a new post | {"title" : "Dice Post", "dateOfCreation" : "13/02/2024", "content" : "my fitness blog", "mediaURL" : "image1", "blogId" : 1} |
SHOW | /posts/:id | GET | Returns details of one specific post | |
UPDATE | /posts/:id | PUT | Updates a specific post | {"title" : "New Dice", "content" : "Different coloured dice", "mediaURL" : "image2"} |
DELETE | /posts/:id | DELETE | Deletes a specific post | |
UPDATE | /posts/:postId/:userId/likes | PATCH | Adds and removes likes |
URL | Method | Description | Request Body | |
---|---|---|---|---|
INDEX | /users | GET | Returns a list of all users | |
CREATE | /users | POST | Creates a new user | {"name" : "Mike", "password" : "hello123"} |
SHOW | /users/:id | GET | Returns details of one specific user | |
UPDATE | /users/:id | PUT | Updates a specific user | {"name" : "Miky", "password" : "hello123"} |
DELETE | /blogs/:id | DELETE | Deletes a specific user |
URL | Method | Description | Request Body | |
---|---|---|---|---|
INDEX | /comments | GET | Returns a list of all comments | |
CREATE | /comments | POST | Creates a new comment | {"text" : "I hated this!", "postId" : 1, "userId" : 1} |
SHOW | /comments/:id | GET | Returns details of one specific comment | |
UPDATE | /comments/:id | PUT | Updates a specific comment | {"text" : "I loved this!"} |
DELETE | /comments/:id | DELETE | Deletes a specific comment |