๐๏ธ San Diego โ CREATE (CRUD Submodule 1)
Quest Chapter: The Food Route
Focus: C in CRUD โ CREATE
Location: San Diego, CA โ๏ธ๐ฎ
Welcome! This interactive page lets learners actually create dishes, ingredients, and join records via simulated API calls โ right in the browser.
๐ฏ San Diego Progress Tracker
๐ฎ Fish Tacos (Baja-style) - Incomplete
๐ฏ California Burrito - Incomplete
๐ Carne Asada Fries - Incomplete
๐ Acai Bowls - Incomplete
๐ฅ Baja Bowl - Incomplete
๐ Baja Seafood - Incomplete
Completion: 0%
Fish Tacos created โ +15 XP
๐ Los Angeles Unlocked!
You can now continue to the next city!
You can now continue to the next city!
- ๐ง What Does CREATE Mean?
- In databases, CREATE = inserting new records (e.g., dishes, ingredients, or join rows).
- On the web, a client form sends a POST /api/dishes request.
- The server creates:
- a new dish record,
- any missing ingredient entries, and
- dish_ingredients join records โ ideally inside a single transaction (all succeed or all fail).
- Analogy: your database is like a kitchen pantry. Adding a dish = adding a recipe card and ensuring all the required ingredients already exist in the pantry.
- In databases, CREATE = inserting new records (e.g., dishes, ingredients, or join rows).
%% Interactive: Mock Backend & Utilities
Initialization:
Resets mock DB (localStorage) โ use this to start fresh.
Terminal: ready
๐ฎ Fish Tacos (Baja-style) CREATE
Create a Fish Taco class with properties (id, fishType, toppings, sauce, price, spiceLevel) and method
calculateTotalPrice() with 8% tax. Validate fishType is required.
๐งฉ Quick Quiz:
1๏ธโฃ Why validate fishType in the constructor?
๐ฏ California Burrito CREATE
Implement CaliforniaBurrito class with properties (id, protein, hasFries, size, extras, price) and method
calculateCalories(). Fries are what make it "California style"!
๐งฉ Quick Quiz:
1๏ธโฃ What makes a burrito "California style"?
๐ Carne Asada Fries CREATE
Build a CarneAsadaFries class with properties (id, friesType, meatPortion, toppings, cheeseType, price) and method
isLoaded() that checks if it has at least 3 toppings.
๐งฉ Quick Quiz:
1๏ธโฃ What makes fries "loaded" in this implementation?
๐ Acai Bowls CREATE
Create an AcaiBowl class with properties (id, size, baseIngredients, toppings, granola, price) and methods
calculateNutritionScore() and isHealthy().
๐งฉ Quick Quiz:
1๏ธโฃ What determines if an acai bowl is "healthy" in this code?
๐ฅ Baja Bowl CREATE via API
Use the form to CREATE a Baja Bowl via our mock API! Fill in the details and make a POST request to simulate database insertion.
No ingredients yet
๐ Baja Seafood CREATE Collection
Create a collection of Baja seafood dishes and bulk insert them into the database using POST /api/dishes/bulk
๐งฉ Quick Quiz:
1๏ธโฃ What's the main benefit of bulk CREATE operations?
๐ Module Complete โ San Diego CREATE Mastery
Congratulations! Youโve mastered CREATE operations through San Diegoโs finest foods:
- ๐ฎ Fish Tacos: Class creation with validation
- ๐ฏ California Burrito: Complex object construction
- ๐ Carne Asada Fries: Method-based data validation
- ๐ Acai Bowls: Health scoring algorithms
- ๐ฅ Baja Bowl: API form submission
- ๐ Baja Seafood: Bulk creation operations
Los Angeles โ READ module unlocked! ๐ Continue to learn querying and data retrieval!