mhammadalam112 / EhsaanTechMernMonth02

0 stars 0 forks source link

Improvements and Cleanup for Codebase #1

Open Nehal409 opened 5 months ago

Nehal409 commented 5 months ago
  1. As outlined in the project roadmap, some components such as services, repositories, and models are absent from the codebase.
  2. Make sure all endpoint names are in plural form. For example, change /dish to /dishes, and organize order routes according to REST principles. For instance, change /listAllOrders to orders/list.
  3. Merge the functionalities of checkIfUserLoggedIn and authenticateUser into a single function.
  4. No need to store username and token in res.cookie. The token will be provided in the header of your request. Additionally, save userId in req within the authentication middleware.
  5. Implement payload validation for each update and post request. Additionally, use different payload schemas for chef/foodie, dishes, and orders.
mhammadalam112 commented 5 months ago
  1. As outlined in the project roadmap, some components such as services, repositories, and models are absent from the codebase.

for models: I am not sure what to include in the models, as per my understanding we use it to include data models and collections when dealing with MongoDB. Please correct me if i am wrong

  1. Merge the functionalities of checkIfUserLoggedIn and authenticateUser into a single function.

I have separated the authenticateUser functionality as it restricts the API to users to only access via JWT authentication, for rest of the APIs any logged in user can perform action