aabu4537 / Team3-Recitation13

2 stars 0 forks source link

POST /favorite #31

Closed EricGraham7 closed 2 years ago

EricGraham7 commented 2 years ago

As a user, I want to be able to select a button that will add a recipe to my favorites so that it will automatically show up in my profile

User Acceptance Criteria: Once I click the button, it must add the recipe in question to the database (in particular, the user and recipe in question already exist, so a row in favorites table must be added)

EricGraham7 commented 2 years ago

Will be called by some kind of form that you use to favorite a recipe. It does not need to be its own page. Updates the database favorites table.

Need from HTML: only one thing, recipe_name

Return to HTML: Nothing

Explanation: POST favorite will take req.body.recipe_name and use this along with req.session.user.user_id to make an insert into query to the favorites table. (the sent recipe will then be included in the JSON object returned by GET profile next time it's called.) Redirects to home.