parametr forceupdate jidla
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
This commit is contained in:
parent
cf8be8c64f
commit
fa4f9903cb
@ -156,7 +156,7 @@ router.get("/refresh", async (req: Request, res: Response) => {
|
||||
const firstDay = getFirstWorkDayOfWeek(getToday());
|
||||
const results: Record<string, any> = {};
|
||||
for (const rest of restaurants) {
|
||||
results[rest] = await getRestaurantMenu(rest, firstDay);
|
||||
results[rest] = await getRestaurantMenu(rest, firstDay, true);
|
||||
}
|
||||
res.status(200).json({ ok: true, refreshed: results });
|
||||
} catch (e: any) {
|
||||
|
@ -84,7 +84,7 @@ async function getMenu(date: Date): Promise<WeekMenu | undefined> {
|
||||
* @param date datum, ke kterému získat menu
|
||||
* @param mock příznak, zda chceme pouze mock data
|
||||
*/
|
||||
export async function getRestaurantMenu(restaurant: Restaurant, date?: Date): Promise<RestaurantDayMenu> {
|
||||
export async function getRestaurantMenu(restaurant: Restaurant, date?: Date, forceRefresh = false): Promise<RestaurantDayMenu> {
|
||||
const usedDate = date ?? getToday();
|
||||
const dayOfWeekIndex = getDayOfWeekIndex(usedDate);
|
||||
const now = new Date().getTime();
|
||||
@ -112,7 +112,7 @@ export async function getRestaurantMenu(restaurant: Restaurant, date?: Date): Pr
|
||||
};
|
||||
}
|
||||
}
|
||||
if (!weekMenu[dayOfWeekIndex][restaurant]?.food?.length) {
|
||||
if (forceRefresh || !weekMenu[dayOfWeekIndex][restaurant]?.food?.length) {
|
||||
const firstDay = getFirstWorkDayOfWeek(usedDate);
|
||||
const mock = process.env.MOCK_DATA === 'true';
|
||||
switch (restaurant) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user