feat: #15416 Expand round robin availability beyond default schedule (#15618)

* add feature to change host schedule

* update for type-check:ci

* Update SingleForm.tsx for linterr

* update as per design review

* update for rerendering

* migration files

* On Delete set null for schedule

if schedule is deleted, no need to delete the host

* updated schema

* added testcases

* checking permissions before

* updated for comments

* update for initial value

* updated and cleanup

* set initial value

* update after merge

* updated nit style

* update for console warning and added comments

* nit/chore

* chore

* update for typechecks

* update for scheduleId param after merge

* update after merge or new changes in metadata.config

* update after weights functionality

* updated description text and column name as per review suggestion

* resolved merge conflicts

* fix typecheck due to changes in getScheduleSchema

* update after merge having refactor

* update refactored EventTypeWebWrapper after merge

* updated props

* updated trpc err code and added log

* update due to refactor in EventAvailabilityTab

* perf: Optimise TS type + select only the data that's needed for a specific function

---------

Co-authored-by: Amit Sharma <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-10-15 17:36:00 +01:00
1 parent c21f0caecf
commit a48d190af3
27 files changed
+600 -67

No files matched your search

@@ -1,6 +1,7 @@
import { useFormContext } from "react-hook-form";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
import type { TeamMembers } from "@calcom/features/eventtypes/components/EventType";
import { EventAvailabilityTab } from "@calcom/features/eventtypes/components/tabs/availability/EventAvailabilityTab";
import type { EventTypeSetup, FormValues } from "@calcom/features/eventtypes/lib/types";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -11,8 +12,12 @@ export type EventAvailabilityTabWebWrapperProps = {
eventType: EventTypeSetup;
isTeamEvent: boolean;
loggedInUser?: RouterOutputs["viewer"]["me"];
teamMembers: TeamMembers;
};
export type GetAllSchedulesByUserIdQueryType =
typeof trpc.viewer.availability.schedule.getAllSchedulesByUserId.useQuery;
const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperProps) => {
const { t } = useLocale();
const formMethods = useFormContext<FormValues>();
@@ -36,6 +41,8 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperPro
const { data: availabilityQueryData, isPending: isAvailabilityPending } =
trpc.viewer.availability.list.useQuery(undefined);
const hostSchedulesQuery = trpc.viewer.availability.schedule.getAllSchedulesByUserId.useQuery;
return (
<EventAvailabilityTab
{...props}
@@ -44,6 +51,7 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperPro
isSchedulePending={isSchedulePending}
scheduleQueryData={scheduleQueryData}
editAvailabilityRedirectUrl={`/availability/${scheduleQueryData?.id}`}
hostSchedulesQuery={hostSchedulesQuery}
/>
);
};
@@ -242,7 +242,12 @@ const EventTypeWeb = ({
/>
),
availability: (
<EventAvailabilityTab eventType={eventType} isTeamEvent={!!team} loggedInUser={loggedInUser} />
<EventAvailabilityTab
eventType={eventType}
isTeamEvent={!!team}
loggedInUser={loggedInUser}
teamMembers={teamMembers}
/>
),
team: <EventTeamAssignmentTab teamMembers={teamMembers} team={team} eventType={eventType} />,
limits: <EventLimitsTab eventType={eventType} />,