fix: harden booking and meeting flows

This commit is contained in:
2026-09-17 02:42:27 +02:00
parent cb30ecade9
commit 66710fc65c
42 changed files with 683 additions and 608 deletions
+25
View File
@@ -0,0 +1,25 @@
import type { BookingRequest } from "@/payload-types";
/** Explicit allow-list at the server/client boundary, including relationships. */
export function customerBookingView(booking: BookingRequest) {
const offer = typeof booking.offer === "object" ? booking.offer : null;
const event = typeof booking.linkedEvent === "object" ? booking.linkedEvent : null;
const alternative = booking.proposedAlternative;
return {
id: booking.id,
date: booking.date,
startTime: booking.startTime,
endTime: booking.endTime,
status: booking.status,
appointmentType: booking.appointmentType,
offer: offer ? { title: offer.title } : null,
linkedEvent: event ? { slug: event.slug, isOnline: event.isOnline } : null,
proposedAlternative: alternative ? {
date: alternative.date,
startTime: alternative.startTime,
endTime: alternative.endTime,
} : null,
};
}
export type CustomerBooking = ReturnType<typeof customerBookingView>;