From f3a4d8ec66a1f00cf5d36122b97b76fa92a31bc2 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Tue, 31 Aug 2021 10:00:38 +0100 Subject: [PATCH] Menuserver - Emails should point to the correct server --- server/lib/FoodObj.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/lib/FoodObj.js b/server/lib/FoodObj.js index 51d40ba..4d08cab 100644 --- a/server/lib/FoodObj.js +++ b/server/lib/FoodObj.js @@ -1,12 +1,13 @@ class FoodObj { constructor(limit) { + this.srcURL = 'https://menu.silvrtree.co.uk'; this.limit = limit; this.store = []; this.soup = {}; this.types = [0, 0, 0, 0, 0, 0, 0]; } - + get () { return this.store; } @@ -14,18 +15,18 @@ class FoodObj { getFirstFive() { return (this.store.slice(0, 5)); } - + getFirstFiveIDs() { const outVal = this.store.slice(0, 5).map((item) => { return item._id; }); - + return (outVal); } add(item) { // console.log('>>', item); - item.url = `https://menu.silvrtree.co.uk/view/${item.short}`; + item.url = `${this.srcURL}/view/${item.short}`; if (this.types[item.meat] < this.limit) { this.store.push(item); this.types[item.meat]++; @@ -33,7 +34,7 @@ class FoodObj { } addSoup(item) { - item.url = `https://menu.silvrtree.co.uk/view/${item.short}`; + item.url = `${this.srcURL}/view/${item.short}`; this.soup = item; } @@ -44,13 +45,13 @@ class FoodObj { count() { return (this.store.slice(0, 5).length); } - + forPug() { const output = { 'menu':null, 'soup':null }; - + output.menu = [...this.getFirstFive()]; output.soup = this.soup; - + return output; } }