feat: booking with phone number (#14461)
Co-authored-by: Omar López <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
85 files changed
+2078
-274
No files matched your search
+15
-4
@@ -39,6 +39,11 @@ export const getEventTypesFromDB = async (id: number) => {
|
||||
bookingFields: true,
|
||||
disableGuests: true,
|
||||
timeZone: true,
|
||||
profile: {
|
||||
select: {
|
||||
organizationId: true,
|
||||
},
|
||||
},
|
||||
teamId: true,
|
||||
owner: {
|
||||
select: userSelect,
|
||||
@@ -82,11 +87,13 @@ export const getEventTypesFromDB = async (id: number) => {
|
||||
}
|
||||
|
||||
const metadata = EventTypeMetaDataSchema.parse(eventType.metadata);
|
||||
const { profile, ...restEventType } = eventType;
|
||||
const isOrgTeamEvent = !!eventType?.team && !!profile?.organizationId;
|
||||
|
||||
return {
|
||||
isDynamic: false,
|
||||
...eventType,
|
||||
bookingFields: getBookingFieldsWithSystemFields(eventType),
|
||||
...restEventType,
|
||||
bookingFields: getBookingFieldsWithSystemFields({ ...eventType, isOrgTeamEvent }),
|
||||
metadata,
|
||||
};
|
||||
};
|
||||
@@ -101,7 +108,7 @@ export const handleSeatsEventTypeOnBooking = async (
|
||||
bookingInfo: Partial<
|
||||
Prisma.BookingGetPayload<{
|
||||
include: {
|
||||
attendees: { select: { name: true; email: true } };
|
||||
attendees: { select: { name: true; email: true; phoneNumber: true } };
|
||||
seatsReferences: { select: { referenceUid: true } };
|
||||
user: {
|
||||
select: {
|
||||
@@ -123,6 +130,7 @@ export const handleSeatsEventTypeOnBooking = async (
|
||||
attendee: {
|
||||
email: string;
|
||||
name: string;
|
||||
phoneNumber: string | null;
|
||||
};
|
||||
id: number;
|
||||
data: Prisma.JsonValue;
|
||||
@@ -141,6 +149,7 @@ export const handleSeatsEventTypeOnBooking = async (
|
||||
select: {
|
||||
name: true,
|
||||
email: true,
|
||||
phoneNumber: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -158,7 +167,9 @@ export const handleSeatsEventTypeOnBooking = async (
|
||||
if (!eventType.seatsShowAttendees && !isHost) {
|
||||
if (seatAttendee) {
|
||||
const attendee = bookingInfo?.attendees?.find((a) => {
|
||||
return a.email === seatAttendee?.attendee?.email;
|
||||
return (
|
||||
a.email === seatAttendee?.attendee?.email || a.phoneNumber === seatAttendee?.attendee?.phoneNumber
|
||||
);
|
||||
});
|
||||
bookingInfo["attendees"] = attendee ? [attendee] : [];
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user