Răsfoiți Sursa

Remove arrow functions from home controller

Lee Morgan 6 ani în urmă
părinte
comite
adf59ec3db
2 a modificat fișierele cu 7 adăugiri și 7 ștergeri
  1. 6 6
      controllers/home.js
  2. 1 1
      models/ingredient.js

+ 6 - 6
controllers/home.js

@@ -10,7 +10,7 @@ const merchantId = "YHVPCQMVB1P81";
 const token = "b48068eb-411a-918e-ea64-52007147e42c";
 
 module.exports = {
-    displayInventory: (req, res)=>{
+    displayInventory: function(req, res){
         Merchant.findOne({posId: merchantId})
             .populate("inventory.ingredient")
             .then((merchant)=>{
@@ -57,7 +57,7 @@ module.exports = {
             });
     },
 
-    merchantSetup: (req, res)=>{
+    merchantSetup: function(req, res){
         Ingredient.find()
             .then((ingredients)=>{
                 axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${merchantId}/items?access_token=${token}`)
@@ -75,7 +75,7 @@ module.exports = {
             })
     },
 
-    getRecipes: (req, res)=>{
+    getRecipes: function(req, res){
         axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${merchantId}/items?access_token=${token}`)
             .then((recipes)=>{
                 return res.json(recipes);
@@ -85,7 +85,7 @@ module.exports = {
             });
     },
 
-    createMerchant: (req, res)=>{
+    createMerchant: function(req, res){
         let data = JSON.parse(req.body.data);
 
         axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${merchantId}?access_token=${token}`)
@@ -124,7 +124,7 @@ module.exports = {
             });
     },
 
-    createNewIngredients: (req, res)=>{
+    createNewIngredients: function(req, res){
         Ingredient.create(req.body)
             .then((ingredients)=>{
                 return res.json(ingredients);
@@ -135,7 +135,7 @@ module.exports = {
             });
     },
 
-    createIngredient: (req, res)=>{
+    createIngredient: function(req, res){
         Ingredient.create(req.body.ingredient)
             .then((ingredient)=>{
                 Merchant.updateOne(

+ 1 - 1
models/ingredient.js

@@ -10,7 +10,7 @@ const IngredientSchema = new mongoose.Schema({
         type: String,
         minlength: [3, "Category name must contain at least three characters"]
     },
-    unitType: {
+    unit: {
         type: String,
         required: [true, "You must provide the measurement unit for this item"]
     }