Skip to content

Feature: Add user routes #1

@nani-samireddy

Description

@nani-samireddy

Description:

We need to create a user management system for our API. The tasks include creating a user model, implementing necessary routes, and adding authentication middleware. This will enable the API to handle user-related operations such as creation, retrieval, updating, deletion, login, logout, and password recovery.

Tasks:

  1. Create User Model

    • Fields:
      • id (unique identifier)
      • name
      • email
      • password
      • phone number
      • cart (array or object to store cart items)
      • wishlist (array or object to store wishlist items)
      • addresses (array of address objects)
      • createdAt (timestamp)
      • updatedAt (timestamp)

    NOTE: This schema might go through some modifications in the future. This is not the final schema.

  2. Add Routes

    Functionality Route Method
    Get All Users /api/user/ GET
    Get User by ID /api/user/:id GET
    Create User /api/user/ POST
    Update User by ID /api/user/:id PUT
    Delete User by ID /api/user/:id DELETE
    Login /api/user/login POST
    Logout /api/user/logout POST
    Forgot Password /api/user/forgot-password POST
  3. Add Authentication Middleware

    • Use cookie and JWT for authentication.
    • Apply middleware to the following routes:
      • updateByID
      • deleteByID
      • logout

Steps to Follow Before Starting the Work:

  1. Clone the repository:
    git clone [email protected]:The-Software-Squad/mvep-api.git
  2. If you already have the repository, checkout to the dev branch:
    git checkout dev
  3. Pull the latest changes:
    git pull origin dev
  4. Create a new branch for this feature:
    git checkout -b feature/add-user-routes

Checklist:

  • Use proper comments and naming conventions.
  • Create User Model with specified fields
  • Implement GET /api/user/ route
  • Implement GET /api/user/:id route
  • Implement POST /api/user/ route
  • Implement PUT /api/user/:id route
  • Implement DELETE /api/user/:id route
  • Implement POST /api/user/login route
  • Implement POST /api/user/logout route
  • Implement POST /api/user/forgot-password route
  • Add authentication middleware using cookie and JWT
  • Apply middleware to updateByID, deleteByID, and logout routes
  • Test all routes and functionalities
  • Update the .env.sample file if you have updated any env variables

Instructions to Raise a Pull Request:

  1. Once all tasks are completed and the code is thoroughly tested, Push your branch to the remote repository:
    git push origin feature/add-user-routes
  2. Go to the repository on GitHub and create a new Pull Request against the dev branch.
  3. Provide a descriptive title and summary for your PR, and request a review from your team members.
  4. Ensure all checks pass and address any feedback given during the review process.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions