Skip to content

Commit

Permalink
fixBooking2
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrui committed Apr 4, 2024
1 parent 545ae3f commit 1870970
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ export const bookService = async (input: FieldResolveInput) =>
bookServices.filter((s): s is WithId<ServiceModel> => typeof s !== 'string'),
bookServices.filter((s): s is string => typeof s === 'string')
];
bookServices.forEach(async (s) => {
if (typeof s === 'string') {

if (busy[0]) {
await o('Services').collection.updateMany(
{ _id: { $in: bookedServices.map((s: any) => s._id) } },
{ $set: { taken: false } },
);
throw new GlobalError(`Service is already taken: ${s}`, import.meta.url);
throw new GlobalError(`Service is already taken: ${busy}`, import.meta.url);
}
return s._id;
});



const book = await o('Bookings')
Expand Down

0 comments on commit 1870970

Please sign in to comment.