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
@@ -1,6 +1,3 @@
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import { z } from "zod";
|
||||
|
||||
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
||||
import type { Dayjs } from "@calcom/dayjs";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
@@ -10,16 +7,14 @@ import {
|
||||
getBusyTimesFromTeamLimits,
|
||||
} from "@calcom/features/busyTimes/lib/getBusyTimesFromLimits";
|
||||
import { getBusyTimesService } from "@calcom/features/di/containers/BusyTimes";
|
||||
import { EventTypeRepository } from "@calcom/features/eventtypes/repositories/eventTypeRepository";
|
||||
import type { EventTypeRepository } from "@calcom/features/eventtypes/repositories/eventTypeRepository";
|
||||
import type { PrismaHolidayRepository } from "@calcom/features/holidays/repositories/PrismaHolidayRepository";
|
||||
import type { PrismaOOORepository } from "@calcom/features/ooo/repositories/PrismaOOORepository";
|
||||
import type { IRedisService } from "@calcom/features/redis/IRedisService";
|
||||
import type { WorkingHours as WorkingHoursWithUserId } from "@calcom/types/schedule";
|
||||
import type { DateOverride, WorkingHours } from "@calcom/features/schedules/lib/date-ranges";
|
||||
import { buildDateRanges, subtract } from "@calcom/features/schedules/lib/date-ranges";
|
||||
import { getWorkingHours } from "@calcom/lib/availability";
|
||||
import { stringToDayjsZod } from "@calcom/lib/dayjs";
|
||||
import { detectEventTypeScheduleForUser } from "./detectEventTypeScheduleForUser";
|
||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||
import { getHolidayService } from "@calcom/lib/holidays";
|
||||
import { getHolidayEmoji } from "@calcom/lib/holidays/getHolidayEmoji";
|
||||
@@ -31,20 +26,23 @@ import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||
import type {
|
||||
Availability,
|
||||
Booking,
|
||||
User,
|
||||
OutOfOfficeEntry,
|
||||
OutOfOfficeReason,
|
||||
EventType as PrismaEventType,
|
||||
Availability,
|
||||
SelectedCalendar,
|
||||
TravelSchedule,
|
||||
User,
|
||||
} from "@calcom/prisma/client";
|
||||
import { SchedulingType } from "@calcom/prisma/enums";
|
||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
import type { CalendarFetchMode, EventBusyDetails, IntervalLimitUnit } from "@calcom/types/Calendar";
|
||||
import type { TimeRange } from "@calcom/types/schedule";
|
||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||
import type { TimeRange, WorkingHours as WorkingHoursWithUserId } from "@calcom/types/schedule";
|
||||
import * as Sentry from "@sentry/nextjs";
|
||||
import { z } from "zod";
|
||||
import { detectEventTypeScheduleForUser } from "./detectEventTypeScheduleForUser";
|
||||
|
||||
const log = logger.getSubLogger({ prefix: ["getUserAvailability"] });
|
||||
|
||||
@@ -407,7 +405,7 @@ export class UserAvailabilityService {
|
||||
const getBusyTimesEnd = dateTo.toISOString();
|
||||
|
||||
const selectedCalendars = eventType?.useEventLevelSelectedCalendars
|
||||
? EventTypeRepository.getSelectedCalendarsFromUser({ user, eventTypeId: eventType.id })
|
||||
? user.allSelectedCalendars.filter((calendar) => calendar.eventTypeId === eventType.id)
|
||||
: user.userLevelSelectedCalendars;
|
||||
|
||||
let calendarTimezone: string | null = null;
|
||||
|
||||
Reference in new issue
Block a user