Scheduling infrastructure for absolutely everyone.
fix: event duration can be 0 (#11145)
Mehulbf437b7d6bb4
diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsxindex fa21ad94a59..8b54d23b629 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-varsmultipleDurationEnabled,+ 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-varsmultipleDurationEnabled,+ 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.jsonindex b33ac6554ac..97a91cdd96e 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.prismaindex 80a4c25478c..c6bf3208d49 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 IntoffsetStart Int @default(0)hidden Boolean @default(false)