chore: Disables syncing of calendarList on overlay calendar fetch (#27020)
* chore: Disables syncing of calendarList on overlay calendar fetch * Unwrap ToggledConnectedCalendars * Pick the right type for connectedCalendars * further type amends * Type fixes, tons of em * Some further fixups consistent with what was before * fix: resolve type incompatibility in getConnectedDestinationCalendars return type Co-Authored-By: [email protected] <[email protected]> * fix: update DestinationCalendarProps to accept tRPC handler return type Co-Authored-By: [email protected] <[email protected]> * fix: use generic type for DestinationCalendarProps to accept tRPC enriched types Co-Authored-By: [email protected] <[email protected]> * fix: simplify DestinationCalendarProps type for better compatibility Co-Authored-By: [email protected] <[email protected]> * fix: export ConnectedCalendar type for consistent type inference Co-Authored-By: [email protected] <[email protected]> * fix: use permissive type for connectedCalendars to accept tRPC enriched types Co-Authored-By: [email protected] <[email protected]> * fix: export ConnectedCalendar and ConnectedDestinationCalendars types from platform-libraries Co-Authored-By: [email protected] <[email protected]> * fix: update ConnectedCalendar type to use boolean | null for primary field Co-Authored-By: [email protected] <[email protected]> * Update ConnectedCalendarItem * Undo some of Devins fixes, more fixes * Fixup the destination calendar return type, historically not null * Change init to undefined to deal with null * Approach to connect selected calendars with the right credential * This return type is used way too much everywhere, not refactoring * Add the selectedCalendars to the type * Actually fix overlay calendar * set calendarsToLoad param as required * Apply suggestion from @cubic-dev-ai[bot] Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Add new translation for 'Calendar Settings' --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
22 files changed
+486
-428
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||
|
||||
import type { PrismaClient } from "@prisma/client";
|
||||
import type { TConnectedCalendarsInputSchema } from "./connectedCalendars.schema";
|
||||
|
||||
type ConnectedCalendarsOptions = {
|
||||
ctx: {
|
||||
user: NonNullable<TrpcSessionUser>;
|
||||
prisma: PrismaClient;
|
||||
};
|
||||
input: TConnectedCalendarsInputSchema;
|
||||
};
|
||||
@@ -23,10 +23,9 @@ type ConnectedCalendarsHandlerResult = {
|
||||
};
|
||||
|
||||
export const connectedCalendarsHandler = async ({
|
||||
ctx,
|
||||
ctx: { user, prisma },
|
||||
input,
|
||||
}: ConnectedCalendarsOptions): Promise<ConnectedCalendarsHandlerResult> => {
|
||||
const { user } = ctx;
|
||||
const onboarding = input?.onboarding || false;
|
||||
|
||||
const { connectedCalendars, destinationCalendar } =
|
||||
@@ -34,6 +33,7 @@ export const connectedCalendarsHandler = async ({
|
||||
user,
|
||||
onboarding,
|
||||
eventTypeId: input?.eventTypeId ?? null,
|
||||
skipSync: input?.skipSync ?? false,
|
||||
prisma,
|
||||
});
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ export type TConnectedCalendarsInputSchema =
|
||||
// Fetches the calendars for this event-type only if present
|
||||
// Otherwise, fetches the calendars for the authenticated user
|
||||
eventTypeId?: number | null;
|
||||
skipSync?: boolean;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
@@ -15,5 +16,6 @@ export const ZConnectedCalendarsInputSchema: z.ZodType<TConnectedCalendarsInputS
|
||||
// Fetches the calendars for this event-type only if present
|
||||
// Otherwise, fetches the calendars for the authenticated user
|
||||
eventTypeId: z.number().nullish(),
|
||||
skipSync: z.boolean().optional(),
|
||||
})
|
||||
.optional();
|
||||
Reference in new issue
Block a user