San Francisco
🌉 San Francisco — UPDATE (CRUD Submodule 3)
Quest Chapter: The Food Route
Focus: U in CRUD — UPDATE
Location: San Francisco, CA 🌉🍜
Welcome! This interactive page teaches UPDATE operations through San Francisco’s iconic food scene. Master data modification, validation, and best practices.
🎯 San Francisco Progress Tracker
🥟 Dim Sum Menu - Incomplete
🍜 Chow Mein Order - Incomplete
🍞 Sourdough Bread - Incomplete
🦀 Dungeness Crab - Incomplete
🍫 Ghirardelli Chocolate - Incomplete
🍲 Cioppino Stew - Incomplete
Completion: 0%
🎉 Seattle Unlocked!
You can now continue to the next city!
You can now continue to the next city!
- 🧠 What Does UPDATE Mean?
- In databases, UPDATE = modifying existing records without creating new ones.
- On the web, a client sends PUT/PATCH requests to modify data.
- The server processes:
- Validation of the update data,
- Identification of the record to modify, and
- Atomic updates to maintain data integrity.
- Analogy: your database is like a recipe book. Updating = editing existing recipes with new ingredients or instructions.
- In databases, UPDATE = modifying existing records without creating new ones.
🥟 Dim Sum Menu UPDATE Class
Learn UPDATE methods by completing the DimSumMenu class. This class manages menu items and their properties.
class DimSumMenu {
constructor(id, name, options = []) {
this.id = id;
this.name = name;
this.options = options;
}
updatePrice(itemId, newPrice) {
const item = this.options.find(o => o.id === itemId);
if (item) item.price = newPrice;
}
updateDescription(itemId, newDesc) {
const item = this.options.find(o => o.id === itemId);
if (item) item.description = newDesc;
}
🍜 Chow Mein Order UPDATE Methods
Master UPDATE operations by understanding the ChowMeinOrder class and its modification methods.
class ChowMeinOrder {
constructor(id, protein, noodleType) {
this.id = id;
this.protein = protein;
this.noodleType = noodleType;
this.spiceLevel = "Medium";
this.extras = [];
}
updateProtein(newProtein) {
this.protein = newProtein;
}
updateNoodleType(newType) {
this.noodleType = newType;
}
🍞 Sourdough Bread UPDATE Form
Practice UPDATE operations by modifying a sourdough bread recipe through a form interface.
No ingredients yet
🦀 Dungeness Crab UPDATE Validation
Learn UPDATE validation concepts using Dungeness Crab as an example. Understand error handling and data integrity.
When updating a Dungeness Crab dish in our database, proper validation is crucial. For example, when updating the recipe we must validate: 1. Required fields: name="Dungeness Crab", ingredients list present 2. Data types: calories=600 (must be a number) 3. Record exists: dish ID must exist before updating This prevents data corruption and ensures accurate crab recipes.
🍫 Ghirardelli Chocolate UPDATE Response
Master UPDATE response handling by understanding what happens after updating Ghirardelli chocolate recipes.
After updating Ghirardelli Chocolate's ingredients or recipe, the API returns important response data: - 200 OK status (update successful) - Updated chocolate recipe in response body - Last modified timestamp for recipe versioning This helps track changes to our chocolate recipes.
🍲 Cioppino Stew UPDATE Best Practices
Learn UPDATE best practices through Cioppino stew management. Understand transactions and concurrent updates.
When updating a complex Cioppino recipe with many ingredients: - Use transactions (update recipe and ingredients together) - Check for concurrent recipe edits - Validate all seafood ingredients exist - Show clear errors if an ingredient is missing This keeps our Cioppino recipe data accurate and complete.
🎉 Module Complete — San Francisco UPDATE Mastery
Congratulations! You’ve mastered UPDATE operations through San Francisco’s culinary scene:
- 🥟 Dim Sum: Class-based update methods
- 🍜 Chow Mein: Object property modification
- 🍞 Sourdough: Form-based PUT requests
- 🦀 Dungeness Crab: Validation and error handling
- 🍫 Ghirardelli: Response handling and timestamps
- 🍲 Cioppino: Best practices and transactions
Seattle — DELETE module unlocked! 🌲 Continue to learn data removal operations!