From 51dd9c64b809fe76eb60060d03f4ef11e8844df9 Mon Sep 17 00:00:00 2001 From: Bcornish Date: Wed, 15 Apr 2026 21:13:38 +0700 Subject: [PATCH] feat(slots): thread rescheduledBy param from URL through to tRPC input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split of #28636 (Part B of 3). Plumbing only — adds a new `rescheduledBy` search param that flows from the URL through `useScheduleForEvent` → `useSchedule` → the tRPC `getSchedule` input schema. Nothing consumes the field yet; it will be read by `_getGuestBusyTimesForReschedule` in Part C to gate guest busy-time blocking on host-initiated reschedules. Concretely: - `apps/web/modules/schedules/hooks/useEvent.ts`: reads `searchParams.get("rescheduledBy")` alongside the existing `rescheduleUid` read and forwards it to `useSchedule`. - `apps/web/modules/schedules/hooks/useSchedule.ts`: adds `rescheduledBy` to `UseScheduleWithCacheArgs` and passes it through to the tRPC query input. - `packages/trpc/server/routers/viewer/slots/types.ts`: adds `rescheduledBy: z.string().nullish()` to `getScheduleSchemaObject`. Backwards compatible — the field is nullish on both the URL and the schema, so older clients keep working unchanged. --- apps/web/modules/schedules/hooks/useEvent.ts | 2 ++ apps/web/modules/schedules/hooks/useSchedule.ts | 3 +++ packages/trpc/server/routers/viewer/slots/types.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/apps/web/modules/schedules/hooks/useEvent.ts b/apps/web/modules/schedules/hooks/useEvent.ts index b91671ededf7d2..19c5688d62afe2 100644 --- a/apps/web/modules/schedules/hooks/useEvent.ts +++ b/apps/web/modules/schedules/hooks/useEvent.ts @@ -101,6 +101,7 @@ export const useScheduleForEvent = ({ const searchParams = useCompatSearchParams(); const rescheduleUid = searchParams?.get("rescheduleUid"); + const rescheduledBy = searchParams?.get("rescheduledBy"); const schedule = useSchedule({ username: usernameFromStore ?? username, @@ -110,6 +111,7 @@ export const useScheduleForEvent = ({ selectedDate, dayCount, rescheduleUid, + rescheduledBy, month: monthFromStore ?? month, duration: durationFromStore ?? duration, isTeamEvent, diff --git a/apps/web/modules/schedules/hooks/useSchedule.ts b/apps/web/modules/schedules/hooks/useSchedule.ts index 90a80dd4ba4831..39992e4a210cd9 100644 --- a/apps/web/modules/schedules/hooks/useSchedule.ts +++ b/apps/web/modules/schedules/hooks/useSchedule.ts @@ -20,6 +20,7 @@ export type UseScheduleWithCacheArgs = { duration?: number | null; dayCount?: number | null; rescheduleUid?: string | null; + rescheduledBy?: string | null; isTeamEvent?: boolean; orgSlug?: string; teamMemberEmail?: string | null; @@ -58,6 +59,7 @@ export const useSchedule = ({ duration, dayCount, rescheduleUid, + rescheduledBy, isTeamEvent, orgSlug, teamMemberEmail, @@ -102,6 +104,7 @@ export const useSchedule = ({ timeZone: timezone ?? "PLACEHOLDER_TIMEZONE", duration: duration ? `${duration}` : undefined, rescheduleUid, + rescheduledBy, orgSlug, teamMemberEmail, routedTeamMemberIds, diff --git a/packages/trpc/server/routers/viewer/slots/types.ts b/packages/trpc/server/routers/viewer/slots/types.ts index 58631316ea16c3..bd5f2f75003442 100644 --- a/packages/trpc/server/routers/viewer/slots/types.ts +++ b/packages/trpc/server/routers/viewer/slots/types.ts @@ -26,6 +26,7 @@ export const getScheduleSchemaObject = z.object({ .optional() .transform((val) => val && parseInt(val)), rescheduleUid: z.string().nullish(), + rescheduledBy: z.string().nullish(), // whether to do team event or user event isTeamEvent: z.boolean().optional().default(false), orgSlug: z.string().nullish(),