feat(issue-2): complete Food Item Library with error handling and DB sequence fix - #115
Closed
AtCloudDiwash wants to merge 22 commits into
Closed
feat(issue-2): complete Food Item Library with error handling and DB sequence fix#115AtCloudDiwash wants to merge 22 commits into
AtCloudDiwash wants to merge 22 commits into
Conversation
…d entity relationship diagram
… add wireframe links
Update milestone2.md to mark completion of pitch preparation and refl…
…ls, and meal-food items
…eting food items - Implemented AddFoodItem page for adding new food items with nutritional information. - Created FoodLibrary page to manage food items with search functionality. - Developed CreateMeal page to allow users to create meals from food items. - Added Dashboard page to track daily macro progress. - Introduced Goals page for setting daily macro targets. - Implemented Meals page to view logged meals with date filtering. - Added CSS styles for new components and pages. - Configured Vite for development with API proxy. - Updated server routes for meals to include fetching by user ID. - Enhanced dotenv configuration for better path handling.
…progress for each feature
…ourdotSiwar/web103_finalproject into fix/milestone-3-basic-features
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes Issue #2 — Food Item Library
This PR completes the Food Item Library feature by hardening all API
interactions with proper error handling and fixing a critical database
sequence bug that prevented new food items from being created.
Changes Made
🛡️ Error Handling & Guard Rails
fetchcalls inCreateMeal.jsx,Meals.jsx,Dashboard.jsx, andFoodLibrary.jsxwithres.okchecks andtry/catchblocks.error-messageCSS class inindex.css— red bannerwith border, used across all pages
🗑️ Delete Protection
handleDeleteinFoodLibrary.jsxnow checksres.okbefore removingan item from the UI
it is referenced in a meal
🗄️ Database Sequence Fix
Added
setvalafter each seed function inreset.jsto sync PostgreSQLauto-increment sequences with hardcoded seed IDs — prevents duplicate
key errors on first insert after seeding
Test Plan
✅ Works Fine
❌ Error Cases
/foods→ red error banner instead of crash/meals→ red error banner instead of crash