Files
shahikitchen-prod/domain/booking/validation.ts
T

18 lines
464 B
TypeScript

import type { BookingDetails } from './entities';
export function isBookingComplete(booking: BookingDetails): boolean {
const hasEventType =
booking.bookingMode === 'table' ||
(booking.eventType !== '' &&
(booking.eventType !== 'other' || booking.eventTypeOther.trim().length > 0));
return !!(
booking.location &&
booking.date &&
booking.time &&
booking.guests &&
booking.name &&
booking.phone &&
hasEventType
);
}