Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend (users, ratings) #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

navyagarwal
Copy link

Created model and (get, put, patch, delete) routes for:

  • Users:
    - name
    - email
    - if management
  • Ratings:
    - date
    - user_id
    - food_id
    - stars
    - tags

Improvements needed:

  • Create routes for ratings that fetch data according to specific date ranges


router.get('/', async(req, res) => {
try{
const ratings = await Rating.find()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate the controller and service logic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name the route files as ratings.routes.js



router.get('/', async(req, res) => {
try{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this, Make a different controller and service

backend/src/routes/users.js Outdated Show resolved Hide resolved


router.get('/', async(req, res) => {
try{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create an index.js file in routes to map routes

@navyagarwal
Copy link
Author

navyagarwal commented Jan 2, 2023

@Apoorvgarg-creator I have made the required changes, please review.

@Apoorvgarg-creator
Copy link
Collaborator

@Apoorvgarg-creator I have made the required changes, please review.

@navyagarwal Let's have a meet later. I reviewed your changes but couldn't find the the service and controller logic separated. I will show you to do for one and also explain it you.

But Good Work on PR !

Merging it for now but we will look into a different pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants