Skip to content

AlFahimBinFaruk/FlaskBook_Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlaskBook Backend API

Client Requirements

As a Guest user, I can

  • View Homepage, Blogs(pagination), User Profile
  • Signup
  • Login

As an Admin user, I can

  • Login
  • Register - new admin can only be registered from backend.
  • View & edit my profile
  • Upload, Update, Delete, Read My contents.
  • CRUD Users
  • CRUD Roles (Only 2 roles Admin, User)
  • CRUD user contents
  • Logout

As a Registered user, I can

  • Login
  • View & Edit or Delete My profile info
  • Upload, Update, Delete, Read My contents.
  • Read others contents.
  • Comment, Delete my comments, and Upvote on every post's (including mine).
  • Logout

Technology

  • Language : Python - version 3
  • Framework : Flask
  • Database : MongoDB

Database Models

Database Model image

Screen shots

Image Image Image Image Image Image Image

API Routes

  • To register - POST
/api/user/register

-body
{
    "first_name":"john",
    "last_name":"doe",
    "email":"[email protected]",
    "password":"123456"
}
  • To login : will get and jwt token. - POST
/api/user/login

-body
{
    "email":"[email protected]",
    "password":"123456"
}
  • To Logout - will logout user/admin - GET
/api/user/logout
  • Get all user list : secured, authorized to admin only - GET
/api/user/all?page=1,per_page=10
  • Get individual user details : secured, only authorized admin and user himself and access it - GET
/api/user/details{user_id}
  • Update user information : secured, only authorized admin and user himself and access it - PUT
/api/user/update/{user_id}

-body
{
    "email":"[email protected]"
}
  • Get my details - GET
/api/user/details/my-profile
  • Update my profile - PUT
/api/user/update/my-profile

-body
{
    "first_name":"fahim"
}
  • Change my password
/api/user/update/change-password
  • Delete a user : secured, only authorized admin and user himself and access it - DELETE
/api/user/delete/{user_id}
  • Get all blog List - all visitors can access it, it will have pagination - GET
/api/blog/all
  • Get Individual user all blog List - all visitors can access it, it will have pagination - GET
/api/blog/my/all
  • Get individual blog details : all visitors can access it - GET
/api/blog/details/{blog_id}
  • Add new blog : only authorized users and admin can do it - POST
/api/blog/add-new

-body
{
    "title":"test 1",
    "description":"test 1 desc"
}
  • Update blog : only user who uploaded it or authorized admin can do it - PUT
/api/blog/update/{id}

-body
{
    "title":"test 1 updated",
    "description":"test 1 desc"
}
  • Delete blog : only user who uploaded it or authorized admin can do it - DELETE
/api/blog/delete/{blog_id}
  • Upvote : only registered user/admin can do it - POST
/api/vote/upvote/{blog_id}
  • Down vote : only registered user/admin can do it - POST
/api/vote/downvote/{blog_id}
  • Get comment list : GET
/api/comment/all/{blog_id}
  • Add new Comment : only registered user/admin can do it - POST
/api/comment/add-new

-body
{
    "blog_id":"66b61b9e87b2c5efc3979d65",
    "body":"test comment"
}
  • Update comment : only registered user and admin can do it - PUT
/api/comment/update/{comment_id}

-body
{
    "body":"test comment updated"
}
  • Delete comment : only registered user and admin can do it - DELETE
/api/comment/delete/{comment_id}

How to Build and Run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages