Skip to content

Commit

Permalink
fix: make bookingResponsesSchema nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
supalarry committed Oct 10, 2024
1 parent d3910a2 commit f3127b3
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const bookingResponsesSchema = z
guests: z.array(z.string()).optional(),
rescheduledReason: z.string().optional(),
})
.passthrough();
.passthrough()
.nullable();

type DatabaseBooking = Booking & {
eventType: {
Expand Down Expand Up @@ -64,15 +65,18 @@ export class OutputBookingsService_2024_08_13 {
language: attendee.locale,
absent: !!attendee.noShow,
})),
guests: bookingResponses.guests,
guests: bookingResponses?.guests,
location: databaseBooking.location,
// note(Lauris): meetingUrl is deprecated
meetingUrl: databaseBooking.location,
absentHost: !!databaseBooking.noShowHost,
};

const bookingTransformed = plainToClass(BookingOutput_2024_08_13, booking, { strategy: "excludeAll" });
bookingTransformed.bookingFieldsResponses = bookingResponses;
if (bookingResponses) {
bookingTransformed.bookingFieldsResponses = bookingResponses;
}

return bookingTransformed;
}

Expand Down Expand Up @@ -121,7 +125,7 @@ export class OutputBookingsService_2024_08_13 {
language: attendee.locale,
absent: !!attendee.noShow,
})),
guests: bookingResponses.guests,
guests: bookingResponses?.guests,
location: databaseBooking.location,
// note(Lauris): meetingUrl is deprecated
meetingUrl: databaseBooking.location,
Expand Down

0 comments on commit f3127b3

Please sign in to comment.