Преглед на файлове

Replace merchant.pos string on the merchant.

Lee Morgan преди 5 години
родител
ревизия
08b1cc4e7a
променени са 4 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 1 1
      controllers/helper.js
  2. 1 1
      controllers/recipeData.js
  3. 4 0
      models/merchant.js
  4. 1 1
      views/dashboardPage/ejs/sidebars/recipeDetails.ejs

+ 1 - 1
controllers/helper.js

@@ -12,7 +12,7 @@ module.exports = {
         let ingredients = {};
 
         return axios.post(`${process.env.SQUARE_ADDRESS}/v2/orders/search`, {
-            location_ids: [merchant.squareLocation],
+            location_ids: [merchant.square.location],
             query: {
                 filter: {
                     date_time_filter: {

+ 1 - 1
controllers/recipeData.js

@@ -90,7 +90,7 @@ module.exports = {
 
     //DELETE - removes a single recipe from the merchant and the database
     removeRecipe: function(req, res){
-        if(res.locals.merchant.square !== undefined){
+        if(res.locals.merchant.pos === "square"){
             return res.json("YOU MUST EDIT YOUR RECIPES INSIDE SQUARE");
         }
         

+ 4 - 0
models/merchant.js

@@ -25,6 +25,10 @@ const MerchantSchema = new mongoose.Schema({
         index: true
     },
     password: String,
+    pos: {
+        type: String,
+        required: true
+    },
     square: {
         id: String,
         accessToken: String,

+ 1 - 1
views/dashboardPage/ejs/sidebars/recipeDetails.ejs

@@ -14,7 +14,7 @@
             </svg>
         </button>
 
-        <% if(merchant.square === undefined){ %>
+        <% if(merchant.pos === "none"){ %>
             <button id="removeRecipeBtn" class="iconButton">
                 <svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                     <polyline points="3 6 5 6 21 6"></polyline>