fix: Bookings API (#13815)
This commit is contained in:
@@ -1289,7 +1289,7 @@ async function handler(
|
||||
}
|
||||
// Pushing fixed user before the luckyUser guarantees the (first) fixed user as the organizer.
|
||||
users = [...availableUsers.filter((user) => user.isFixed), ...luckyUsers];
|
||||
luckyUserResponse = { luckyUsers };
|
||||
luckyUserResponse = { luckyUsers: luckyUsers.map((u) => u.id) };
|
||||
} else if (req.body.allRecurringDates && eventType.schedulingType === SchedulingType.ROUND_ROBIN) {
|
||||
// all recurring slots except the first one
|
||||
const luckyUsersFromFirstBooking = luckyUsers
|
||||
@@ -1576,7 +1576,18 @@ async function handler(
|
||||
});
|
||||
if (newBooking) {
|
||||
req.statusCode = 201;
|
||||
return { ...newBooking, ...luckyUserResponse };
|
||||
const bookingResponse = {
|
||||
...newBooking,
|
||||
user: {
|
||||
...newBooking.user,
|
||||
email: null,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
...bookingResponse,
|
||||
...luckyUserResponse,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (isTeamEventType) {
|
||||
@@ -2170,8 +2181,18 @@ async function handler(
|
||||
});
|
||||
|
||||
req.statusCode = 201;
|
||||
return {
|
||||
// TODO: Refactor better so this booking object is not passed
|
||||
// all around and instead the individual fields are sent as args.
|
||||
const bookingReponse = {
|
||||
...booking,
|
||||
user: {
|
||||
...booking.user,
|
||||
email: null,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
...bookingReponse,
|
||||
...luckyUserResponse,
|
||||
message: "Payment required",
|
||||
paymentUid: payment?.uid,
|
||||
@@ -2299,8 +2320,19 @@ async function handler(
|
||||
|
||||
// booking successful
|
||||
req.statusCode = 201;
|
||||
return {
|
||||
|
||||
// TODO: Refactor better so this booking object is not passed
|
||||
// all around and instead the individual fields are sent as args.
|
||||
const bookingResponse = {
|
||||
...booking,
|
||||
user: {
|
||||
...booking.user,
|
||||
email: null,
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
...bookingResponse,
|
||||
...luckyUserResponse,
|
||||
references: referencesToCreate,
|
||||
seatReferenceUid: evt.attendeeSeatId,
|
||||
|
||||
@@ -40,7 +40,7 @@ export const handleNewRecurringBooking = async (
|
||||
};
|
||||
|
||||
const firstBookingResult = await handleNewBooking(recurringEventReq);
|
||||
luckyUsers = firstBookingResult.luckyUsers?.map((user) => user.id);
|
||||
luckyUsers = firstBookingResult.luckyUsers;
|
||||
}
|
||||
|
||||
for (let key = isRoundRobin ? 1 : 0; key < data.length; key++) {
|
||||
|
||||
Reference in New Issue
Block a user