Skip to content

Commit 1870970

Browse files
committed
fixBooking2
1 parent 545ae3f commit 1870970

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/integrations/gei-bookings/src/UserMutation/bookService.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ export const bookService = async (input: FieldResolveInput) =>
2727
bookServices.filter((s): s is WithId<ServiceModel> => typeof s !== 'string'),
2828
bookServices.filter((s): s is string => typeof s === 'string')
2929
];
30-
bookServices.forEach(async (s) => {
31-
if (typeof s === 'string') {
30+
31+
if (busy[0]) {
3232
await o('Services').collection.updateMany(
3333
{ _id: { $in: bookedServices.map((s: any) => s._id) } },
3434
{ $set: { taken: false } },
3535
);
36-
throw new GlobalError(`Service is already taken: ${s}`, import.meta.url);
36+
throw new GlobalError(`Service is already taken: ${busy}`, import.meta.url);
3737
}
38-
return s._id;
39-
});
38+
4039

4140

4241
const book = await o('Bookings')

0 commit comments

Comments
 (0)