فهرست منبع

Update backend to handle alternate units for recipe ingredients.

Lee Morgan 5 سال پیش
والد
کامیت
7eff8f95a0
2فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 3 1
      controllers/recipeData.js
  2. 2 1
      models/recipe.js

+ 3 - 1
controllers/recipeData.js

@@ -15,7 +15,8 @@ module.exports = {
         category: String
         ingredients: [{
             id: id of ingredient,
-            quantity: quantity of ingredient in recipe
+            quantity: quantity of ingredient in recipe,
+            unit: String
         }]
     }
     Return = newly created recipe in same form as above, with _id
@@ -57,6 +58,7 @@ module.exports = {
         ingredients: [{
             ingredient: id of ingredient,
             quantity: quantity of ingredient in recipe
+            unit: String
         }]
     }
     */

+ 2 - 1
models/recipe.js

@@ -45,7 +45,8 @@ const RecipeSchema = new mongoose.Schema({
             type: Number,
             min: [0, "QUANTITY OF INGREDIENTS CANNOT BE A NEGATIVE NUMBER"],
             required: [true, "MUST PROVED A QUANTITY FOR ALL INGREDIENTS"]
-        }
+        },
+        unit: String
     }]
 });