fix: Duplicate calls syncing Calendar integrations (#26858)
* fix: Duplicate calls syncing Calendar integrations * fix: TS error in handler * Minor fixup * Set cacheUpdatedAt at correct depth of array * Import RouterOutputs
This commit is contained in:
1 parent
a708e088c9
commit
1dd2652080
8 files changed
+164
-133
No files matched your search
@@ -11,7 +11,21 @@ type ConnectedCalendarsOptions = {
|
||||
input: TConnectedCalendarsInputSchema;
|
||||
};
|
||||
|
||||
export const connectedCalendarsHandler = async ({ ctx, input }: ConnectedCalendarsOptions) => {
|
||||
type GetConnectedDestinationCalendarsAndEnsureDefaultsInDbResult = Awaited<
|
||||
ReturnType<typeof getConnectedDestinationCalendarsAndEnsureDefaultsInDb>
|
||||
>;
|
||||
|
||||
type ConnectedCalendarsHandlerResult = {
|
||||
destinationCalendar: GetConnectedDestinationCalendarsAndEnsureDefaultsInDbResult["destinationCalendar"];
|
||||
connectedCalendars: (GetConnectedDestinationCalendarsAndEnsureDefaultsInDbResult["connectedCalendars"][number] & {
|
||||
cacheUpdatedAt: null;
|
||||
})[];
|
||||
};
|
||||
|
||||
export const connectedCalendarsHandler = async ({
|
||||
ctx,
|
||||
input,
|
||||
}: ConnectedCalendarsOptions): Promise<ConnectedCalendarsHandlerResult> => {
|
||||
const { user } = ctx;
|
||||
const onboarding = input?.onboarding || false;
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const ZConnectedCalendarsInputSchema = z
|
||||
export type TConnectedCalendarsInputSchema =
|
||||
| {
|
||||
onboarding?: boolean;
|
||||
// Fetches the calendars for this event-type only if present
|
||||
// Otherwise, fetches the calendars for the authenticated user
|
||||
eventTypeId?: number | null;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
export const ZConnectedCalendarsInputSchema: z.ZodType<TConnectedCalendarsInputSchema> = z
|
||||
.object({
|
||||
onboarding: z.boolean().optional(),
|
||||
// Fetches the calendars for this event-type only if present
|
||||
// Otherwise, fetches the calendars for the authenticated user
|
||||
eventTypeId: z.number().nullable(),
|
||||
eventTypeId: z.number().nullish(),
|
||||
})
|
||||
.optional();
|
||||
|
||||
export type TConnectedCalendarsInputSchema = z.infer<typeof ZConnectedCalendarsInputSchema>;
|
||||
Reference in new issue
Block a user