server 1.0.3

This commit is contained in:
2020-09-19 18:16:50 +02:00
parent 36dd3d8238
commit d7395f5472
8 changed files with 35 additions and 13 deletions

View File

@@ -105,15 +105,21 @@ export async function renewSubscription(restaurantId, monthsToAdd) {
}
export async function fetchRestaurant(id) {
let data;
await Restaurant.findById(id, (err, result) => {
data = result;
}).catch((e) => {
const data = await Restaurant.findById(id).catch((e) => {
throw newError("Nie udało się pobrać restauracji.", 500);
});
return data;
}
export async function fetchMultipleRestaurants(idArray) {
let data = [];
for (const id of idArray) {
let response = await fetchRestaurant(id);
data.push(response);
}
return data;
}
export async function fetchAllDishesForRestaurant(restaurant) {
let dishes = [];
for (const dish of restaurant.dishes) {