diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsx index fa21ad94a5..8b54d23b62 100644 --- a/apps/web/pages/event-types/[type]/index.tsx +++ b/apps/web/pages/event-types/[type]/index.tsx @@ -376,9 +376,12 @@ const EventTypePage = (props: EventTypeSetupProps) => { bookerLayouts, // eslint-disable-next-line @typescript-eslint/no-unused-vars multipleDurationEnabled, + length, ...input } = values; + if (!Number(length)) throw new Error(t("event_setup_length_error")); + if (bookingLimits) { const isValid = validateIntervalLimitOrder(bookingLimits); if (!isValid) throw new Error(t("event_setup_booking_limits_error")); @@ -396,7 +399,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { if (metadata?.multipleDuration.length < 1) { throw new Error(t("event_setup_multiple_duration_error")); } else { - if (!input.length && !metadata?.multipleDuration?.includes(input.length)) { + if (!length && !metadata?.multipleDuration?.includes(length)) { throw new Error(t("event_setup_multiple_duration_default_error")); } } @@ -410,6 +413,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { const { availability, ...rest } = input; updateMutation.mutate({ ...rest, + length, locations, recurringEvent, periodStartDate: periodDates.startDate, @@ -467,9 +471,12 @@ const EventTypePage = (props: EventTypeSetupProps) => { seatsPerTimeSlotEnabled, // eslint-disable-next-line @typescript-eslint/no-unused-vars multipleDurationEnabled, + length, ...input } = values; + if (!Number(length)) throw new Error(t("event_setup_length_error")); + if (bookingLimits) { const isValid = validateIntervalLimitOrder(bookingLimits); if (!isValid) throw new Error(t("event_setup_booking_limits_error")); @@ -487,7 +494,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { if (metadata?.multipleDuration.length < 1) { throw new Error(t("event_setup_multiple_duration_error")); } else { - if (!input.length && !metadata?.multipleDuration?.includes(input.length)) { + if (!length && !metadata?.multipleDuration?.includes(length)) { throw new Error(t("event_setup_multiple_duration_default_error")); } } @@ -496,6 +503,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { const { availability, ...rest } = input; updateMutation.mutate({ ...rest, + length, locations, recurringEvent, periodStartDate: periodDates.startDate, diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index b33ac6554a..97a91cdd96 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2045,5 +2045,6 @@ "include_calendar_event": "Include calendar event", "recently_added":"Recently added", "no_members_found": "No members found", + "event_setup_length_error":"Event Setup: The duration must be at least 1 minute.", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index 80a4c25478..c6bf3208d4 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -56,6 +56,7 @@ model EventType { position Int @default(0) /// @zod.custom(imports.eventTypeLocations) locations Json? + /// @zod.min(1) length Int offsetStart Int @default(0) hidden Boolean @default(false)