# Postgram ## Database Structure - **User** | Attribute | Type | | ------------- | :----- | | Name | String | | Email(unique) | String | - **OTP** | Attribute | Type | | ------------- | :----- | | Email(unique) | String | | otp | String | **It is used to verify email address and it get deleted after 5 minutes from creation.** - **Post** | Attribute | Type | | :------------ | :----- | | \_id | String | | Author_id | String | | Title | String | | Body | String | | Comment_Count | Number | | Reply_Count | Number | **Author_id is referenced to Email of User** - **Comment** | Attribute | Type | | :-------- | :----- | | \_id | String | | Author_id | String | | Post_id | String | | Body | String | **Author_id is referenced to Email of User** **Post_id is referenced to \_id of Post** - **Reply** | Attribute | Type | | :--------- | :----- | | \_id | String | | Author_id | String | | Post_id | String | | Comment_id | String | | Body | String | **Author_id is referenced to Email of User** **Post_id is referenced to \_id of Post** **Comment_id is referenced to \_id of Comment** ## API - Used axios library to interact with APIs. ### For User - **login** - Takes email as input data and verifies the user. - **signup** - Takes email and username as input data and creates an account for user. - **sendotp** - Takes email as input and sends and otp which is verified in login and signup API to verify emails. ### For Post - **GetAllPostList** - To get all post from every user. - **GetPostList** - TO get only your posts. - **CreatePost** - TO create a new post. - **GetPost** - To get a specific post using post_id. - **AddComment** - To add a comment on a post - **AddReply** - To add a reply on a comment of a post.