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

Add browse routes for ingredients & materials #84

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions backend/src/controllers/userControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ const edit = async (req, res, next) => {
// Extract the user data from the request body
const item = req.body;
item.ID = wantedId;

const avatar = req.file;

fs.renameSync(
`${avatar.destination}/${avatar.filename}`,
`${avatar.destination}/${avatar.filename}-${avatar.originalname}`
Expand Down
2 changes: 2 additions & 0 deletions backend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ router.post(
// Import ingredientControllers module for handling item-related operations
const IngredientControllers = require("./controllers/ingredientControllers");

router.get("/ingredients", IngredientControllers.browse); // Route to get a list of items
router.get("/ingredient/:id", IngredientControllers.read); // Route to get a specific item by ID
router.get("/ingredientbyrecipe/:id", IngredientControllers.readByRecipe); // Route to get ingredients for a specific Recipe

Expand All @@ -77,6 +78,7 @@ router.get("/ingredientbyrecipe/:id", IngredientControllers.readByRecipe); // Ro
// Import materialControllers module for handling item-related operations
const MaterialControllers = require("./controllers/materialControllers");

router.get("/materials", MaterialControllers.browse); // Route to get a list of items
router.get("/material/:id", MaterialControllers.read); // Route to get a specific item by ID
router.get("/materialByRecipe/:id", MaterialControllers.readByRecipe); // Route to get materials for a specific Recipe

Expand Down
Loading