Menuserver

- Emails should point to the correct server
This commit is contained in:
Martin Donnelly 2021-08-31 10:00:38 +01:00
parent b057ce1092
commit f3a4d8ec66

View File

@ -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;
}
}