Coder Social home page Coder Social logo

saminyasar004 / todo-backend Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 67 KB

Simple Todo app where user can login his account and get access only his todo and their also an admin who have all access to edit, delete, get user's data.

JavaScript 98.78% Dockerfile 1.22%
authentication express express-js expressjs jwt jwt-authentication mern-stack mern-todo-app mongodb mongoose

todo-backend's Introduction

Todo App

Simple Todo app where user can login his account and get access only his todo and their also an admin who have all access to edit, delete, get user's data.

Website Facebook Follow Facebook Page Instagram Follow Twitter Follow Stack Overflow Github Follow

Schema

  • User

    • _id
    • name
    • email unique
    • password
    • role - [admin, user]
    • accountStatus - [pending, active, rejected]
  • Todo

    • _id
    • title unique
    • description
    • todoStatus - [incomplete, inProgress, completed]
    • authorId
  • Token

    • _id
    • token
    • authorId

API Router Endpoints

  • Admin

    • Authorization and JWT Token require

    • /api/v1/admin/u/all - GET - Return all users

    • /api/v1/admin/u/:userId - PATCH - Only edit accountStatus and role

  • User

    • /api/v1/u/register - POST - Register a new user
    • /api/v1/u/login - GET - Login a user and return a JWT token
    • /api/v1/u/logout - GET - Expire the JWT for a logged in user
    • /api/v1/u/update - PATCH - Update only user's name JWT require
    • /api/v1/u/forgetPassword - POST - Get a pincode in user's mail to change password
    • /api/v1/u/changePassword - PATCH - [pinCode, oldPassword, newPassword] - update the user's password
  • Todo

    • All routes below only works for the logged in user && Authentication require

    • /api/v1/t/new - POST - Creates a new Todo and authenticate user by JWT token

    • /api/v1/t/:todoId - GET - Get a single Todo and authenticate user by JWT token

    • /api/v1/t/all - GET - Get all Todos and authenticate user by JWT token

    • /api/v1/t/:todoId - PATCH - Update acceptable information of the requested Todo and authenticate user by JWT token

    • /api/v1/t/:todoId - DELETE - Delete the requested Todo and authenticate user by JWT token

Features

  • Admin

    1. The first user of this system will be an admin
    2. Admin can get all user's data (except password)
    3. Admin can edit an user's accountStatus and role
  • User

    1. If the user's accountStatus is pending then user couldn't create any todo untill the admin active this account. only can login.
    2. If the user's accountStatus is rejected then user couldn't login. He must have to contact with the admin through email to activate his account.
  • Token

    1. Whenever a user/admin login he gets a JWT token and then the token will be saved in the token database. An user/admin can have only one valid token at a time.

Happy Coding. ๐Ÿš€

todo-backend's People

Contributors

manojsingh1999 avatar saminyasar004 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.