-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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:
-
Create User Model
- Fields:
id(unique identifier)nameemailpasswordphone numbercart(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.
- Fields:
-
Add Routes
Functionality Route Method Get All Users /api/user/GETGet User by ID /api/user/:idGETCreate User /api/user/POSTUpdate User by ID /api/user/:idPUTDelete User by ID /api/user/:idDELETELogin /api/user/loginPOSTLogout /api/user/logoutPOSTForgot Password /api/user/forgot-passwordPOST -
Add Authentication Middleware
- Use cookie and JWT for authentication.
- Apply middleware to the following routes:
updateByIDdeleteByIDlogout
Steps to Follow Before Starting the Work:
- Clone the repository:
git clone [email protected]:The-Software-Squad/mvep-api.git
- If you already have the repository, checkout to the
devbranch:git checkout dev
- Pull the latest changes:
git pull origin dev
- 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/:idroute - Implement
POST /api/user/route - Implement
PUT /api/user/:idroute - Implement
DELETE /api/user/:idroute - Implement
POST /api/user/loginroute - Implement
POST /api/user/logoutroute - Implement
POST /api/user/forgot-passwordroute - Add authentication middleware using cookie and JWT
- Apply middleware to
updateByID,deleteByID, andlogoutroutes - Test all routes and functionalities
- Update the
.env.samplefile if you have updated any env variables
Instructions to Raise a Pull Request:
- 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
- Go to the repository on GitHub and create a new Pull Request against the
devbranch. - Provide a descriptive title and summary for your PR, and request a review from your team members.
- Ensure all checks pass and address any feedback given during the review process.
Reactions are currently unavailable