Disable reserve slot on seated events (#8761)
* Disable reserve slot on seated events * Move seats and reserve logic to backend * Pass booking attendees * Type fix * Create booking when two users choose a slot before booking is created * Update packages/trpc/server/routers/viewer/slots/reserveSlot.handler.ts --------- Co-authored-by: alannnc <[email protected]>
This commit is contained in:
1 parent
fbbcc401cb
commit
94917dbb1e
5 files changed
+68
-27
No files matched your search
@@ -1014,9 +1014,17 @@ async function handler(
|
||||
message?: string;
|
||||
})
|
||||
| null = null;
|
||||
const booking = await prisma.booking.findUniqueOrThrow({
|
||||
const booking = await prisma.booking.findFirst({
|
||||
where: {
|
||||
uid: rescheduleUid || reqBody.bookingUid,
|
||||
OR: [
|
||||
{
|
||||
uid: rescheduleUid || reqBody.bookingUid,
|
||||
},
|
||||
{
|
||||
eventTypeId: eventType.id,
|
||||
startTime: evt.startTime,
|
||||
},
|
||||
],
|
||||
},
|
||||
select: {
|
||||
uid: true,
|
||||
@@ -1029,6 +1037,11 @@ async function handler(
|
||||
status: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!booking) {
|
||||
throw new HttpError({ statusCode: 404, message: "Could not find booking" });
|
||||
}
|
||||
|
||||
// See if attendee is already signed up for timeslot
|
||||
if (
|
||||
booking.attendees.find((attendee) => attendee.email === invitee[0].email) &&
|
||||
|
||||
Reference in new issue
Block a user