feat: Setting for rescheduling past bookings (#18358)

* feat: Setting for rescheduling past bookings

* fix stuff

* rename column

* add e2e test

* fix column name

* fix typo

---------

Co-authored-by: Anik Dhabal Babu <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-01-28 19:25:41 +00:00
1 parent 39891ee308
commit 438a73b0cd
17 files changed
+97 -17

No files matched your search

@@ -476,6 +476,7 @@ export const EventAdvancedTab = ({
const eventTypeColorLocked = shouldLockDisableProps("eventTypeColor");
const lockTimeZoneToggleOnBookingPageLocked = shouldLockDisableProps("lockTimeZoneToggleOnBookingPage");
const multiplePrivateLinksLocked = shouldLockDisableProps("multiplePrivateLinks");
const reschedulingPastBookingsLocked = shouldLockDisableProps("allowReschedulingPastBookings");
const { isLocked, ...eventNameLocked } = shouldLockDisableProps("eventName");
if (isManagedEventType) {
@@ -893,6 +894,21 @@ export const EventAdvancedTab = ({
/>
)}
/>
<Controller
name="allowReschedulingPastBookings"
render={({ field: { value, onChange } }) => (
<SettingsToggle
labelClassName={classNames("text-sm")}
toggleSwitchAtTheEnd={true}
switchContainerClassName={classNames("border-subtle rounded-lg border py-6 px-4 sm:px-6")}
title={t("allow_rescheduling_past_events")}
{...reschedulingPastBookingsLocked}
description={t("allow_rescheduling_past_events_description")}
checked={value}
onCheckedChange={(e) => onChange(e)}
/>
)}
/>
<Controller
name="eventTypeColor"
render={() => (
+1
View File
@@ -88,6 +88,7 @@ const commons = {
seatsShowAttendees: null,
seatsShowAvailabilityCount: null,
onlyShowFirstAvailableSlot: false,
allowReschedulingPastBookings: false,
id: 0,
hideCalendarNotes: false,
hideCalendarEventDetails: false,
+1
View File
@@ -35,6 +35,7 @@ export const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
afterEventBuffer: true,
seatsPerTimeSlot: true,
onlyShowFirstAvailableSlot: true,
allowReschedulingPastBookings: true,
seatsShowAttendees: true,
seatsShowAvailabilityCount: true,
scheduleId: true,
@@ -501,6 +501,7 @@ export class EventTypeRepository {
onlyShowFirstAvailableSlot: true,
durationLimits: true,
assignAllTeamMembers: true,
allowReschedulingPastBookings: true,
assignRRMembersUsingSegment: true,
rrSegmentQueryValue: true,
isRRWeightsEnabled: true,
@@ -784,6 +785,7 @@ export class EventTypeRepository {
periodStartDate: true,
periodEndDate: true,
onlyShowFirstAvailableSlot: true,
allowReschedulingPastBookings: true,
periodCountCalendarDays: true,
rescheduleWithSameRoundRobinHost: true,
periodDays: true,
+1
View File
@@ -146,6 +146,7 @@ export const buildEventType = (eventType?: Partial<EventType>): EventType => {
rrSegmentQueryValue: null,
autoTranslateDescriptionEnabled: false,
useEventLevelSelectedCalendars: false,
allowReschedulingPastBookings: false,
...eventType,
};
};
@@ -90,6 +90,7 @@ export const useEventTypeForm = ({
requiresConfirmationForFreeEmail: eventType.requiresConfirmationForFreeEmail,
slotInterval: eventType.slotInterval,
minimumBookingNotice: eventType.minimumBookingNotice,
allowReschedulingPastBookings: eventType.allowReschedulingPastBookings,
metadata: eventType.metadata,
hosts: eventType.hosts.sort((a, b) => sortHosts(a, b, eventType.isRRWeightsEnabled)),
successRedirectUrl: eventType.successRedirectUrl || "",
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "EventType" ADD COLUMN "allowReschedulingPastBookings" BOOLEAN NOT NULL DEFAULT false;
+1
View File
@@ -166,6 +166,7 @@ model EventType {
fieldTranslations EventTypeTranslation[]
maxLeadThreshold Int?
selectedCalendars SelectedCalendar[]
allowReschedulingPastBookings Boolean @default(false)
/// @zod.custom(imports.eventTypeColor)
eventTypeColor Json?
+1
View File
@@ -748,6 +748,7 @@ export const allManagedEventTypeProps: { [k in keyof Omit<Prisma.EventTypeSelect
assignAllTeamMembers: true,
isRRWeightsEnabled: true,
eventTypeColor: true,
allowReschedulingPastBookings: true,
rescheduleWithSameRoundRobinHost: true,
maxLeadThreshold: true,
};
@@ -236,6 +236,7 @@ export async function getBookings({
seatsShowAttendees: true,
seatsShowAvailabilityCount: true,
eventTypeColor: true,
allowReschedulingPastBookings: true,
schedulingType: true,
length: true,
team: {
@@ -716,6 +716,7 @@ async function getExistingBookings(
seatsPerTimeSlot: true,
requiresConfirmationWillBlockSlot: true,
requiresConfirmation: true,
allowReschedulingPastBookings: true,
},
},
...(!!eventType?.seatsPerTimeSlot && {