fix: guests are not adding when reschedule booking (#23620)
* fix: guests are not adding when reschedule booking * Update addGuests.handler.ts * add types
This commit is contained in:
1 parent
ce4d71ba2e
commit
7a6e16631b
2 files changed
+9
No files matched your search
@@ -177,6 +177,8 @@ export const bookingResponses = z
|
||||
})
|
||||
.nullable();
|
||||
|
||||
export type BookingResponses = z.infer<typeof bookingResponses>;
|
||||
|
||||
export const eventTypeLocations = z.array(
|
||||
z.object({
|
||||
// TODO: Couldn't find a way to make it a union of types from App Store locations
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { isTeamAdmin, isTeamOwner } from "@calcom/lib/server/queries/teams";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { BookingResponses } from "@calcom/prisma/zod-utils";
|
||||
import type { CalendarEvent } from "@calcom/types/Calendar";
|
||||
|
||||
import { TRPCError } from "@trpc/server";
|
||||
@@ -89,6 +90,8 @@ export const addGuestsHandler = async ({ ctx, input }: AddGuestsOptions) => {
|
||||
};
|
||||
});
|
||||
|
||||
const bookingResponses = booking.responses as BookingResponses;
|
||||
|
||||
const bookingAttendees = await prisma.booking.update({
|
||||
where: {
|
||||
id: bookingId,
|
||||
@@ -102,6 +105,10 @@ export const addGuestsHandler = async ({ ctx, input }: AddGuestsOptions) => {
|
||||
data: guestsFullDetails,
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
...bookingResponses,
|
||||
guests: [...(bookingResponses?.guests || []), ...uniqueGuests],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user