Browse Source

Remove the archiving of recipes.

Lee Morgan 5 years ago
parent
commit
d69dd0af7a
2 changed files with 0 additions and 45 deletions
  1. 0 10
      controllers/recipeData.js
  2. 0 35
      models/archivedRecipe.js

+ 0 - 10
controllers/recipeData.js

@@ -1,5 +1,4 @@
 const Recipe = require("../models/recipe.js");
-const ArchivedRecipe = require("../models/archivedRecipe.js");
 
 const helper = require("./helper.js");
 
@@ -65,15 +64,6 @@ module.exports = {
     updateRecipe: function(req, res){
         Recipe.findOne({_id: req.body.id})
             .then((recipe)=>{
-                new ArchivedRecipe({
-                    merchant: res.locals.merchant._id,
-                    name: recipe.name,
-                    price: recipe.price,
-                    category: recipe.category,
-                    date: new Date(),
-                    ingredients: recipe.ingredients
-                }).save().catch(()=>{});
-
                 recipe.name = req.body.name;
                 recipe.price = req.body.price;
                 recipe.category = req.body.category;

+ 0 - 35
models/archivedRecipe.js

@@ -1,35 +0,0 @@
-const mongoose = require("mongoose");
-
-const ArchivedRecipeSchema = new mongoose.Schema({
-    merchant: {
-        type: mongoose.Schema.Types.ObjectId,
-        ref: "Merchant",
-        required: true,
-        index: true
-    },
-    name: {
-        type: String,
-        required: true
-    },
-    price: {
-        type: Number,
-        required: true
-    },
-    date: {
-        type: Date,
-        default: Date.now
-    },
-    ingredients: [{
-        ingredient: {
-            type: mongoose.Schema.Types.ObjectId,
-            ref: "Ingredient",
-            required: true
-        },
-        quantity: {
-            type: Number,
-            required: true
-        }
-    }]
-});
-
-module.exports = mongoose.model("RecipeChange", ArchivedRecipeSchema);