From 87b20cead9015b121d32bc253fd75ac8bba795b2 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 11 Feb 2024 14:33:21 +0100 Subject: [PATCH] async fix --- src/controllers/calendarController.ts | 11 ++++------- src/controllers/usersController.ts | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/controllers/calendarController.ts b/src/controllers/calendarController.ts index 9d587e3..f0f9368 100644 --- a/src/controllers/calendarController.ts +++ b/src/controllers/calendarController.ts @@ -336,7 +336,7 @@ export async function UpdateStoreCalendarSettings(req: Request, res: Response) { calendar_min_earliest_booking_time: calendarMinEarliestBookingTime, }; - terminPlanerRequestChangeFutureBookingDays(store.store_id); + await terminPlanerRequestChangeFutureBookingDays(store.store_id); } if (Object.keys(update).length === 0) { @@ -347,12 +347,9 @@ export async function UpdateStoreCalendarSettings(req: Request, res: Response) { where: { store_id: store.store_id, }, - }) - .then(() => res.status(200).send({ msg: "success" })) - .catch((err) => { - logger.error(err); - res.status(500).send({ err: "invalid request" }); - }); + }); + + res.status(200).send({ msg: "success" }); } catch (error) { logger.error(error); res.status(500).send({ err: "invalid request" }); diff --git a/src/controllers/usersController.ts b/src/controllers/usersController.ts index 07ca760..26ea8b2 100644 --- a/src/controllers/usersController.ts +++ b/src/controllers/usersController.ts @@ -369,7 +369,7 @@ export async function UpdateEmployee(req: Request, res: Response) { calendar_min_earliest_booking_time: calendarMinEarliestBookingTime, }; - terminPlanerRequestChangeFutureBookingDays(store.store_id); + await terminPlanerRequestChangeFutureBookingDays(store.store_id); } if (Object.keys(update).length === 0) {