Skip to content

Scheduling infrastructure for absolutely everyone.

refactor: move handleNotificationWhenNoSlots from trpc to features/slots (#25538)

Benny Joo584f5581fa35
diff --git a/packages/features/di/containers/NoSlotsNotification.ts b/packages/features/di/containers/NoSlotsNotification.ts
index 569a600cd10..a0033c7f076 100644
--- a/packages/features/di/containers/NoSlotsNotification.ts
+++ b/packages/features/di/containers/NoSlotsNotification.ts
@@ -2,7 +2,7 @@ import { DI_TOKENS } from "@calcom/features/di/tokens";
import { redisModule } from "@calcom/features/redis/di/redisModule";
import { membershipRepositoryModule } from "@calcom/features/users/di/MembershipRepository.module";
import { prismaModule } from "@calcom/features/di/modules/Prisma";
-import type { NoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
+import type { NoSlotsNotificationService } from "@calcom/features/slots/handleNotificationWhenNoSlots";
import { createContainer } from "../di";
import { noSlotsNotificationModule } from "../modules/NoSlotsNotification";
diff --git a/packages/features/di/modules/NoSlotsNotification.ts b/packages/features/di/modules/NoSlotsNotification.ts
index c8e9e65368f..40e3a4488b5 100644
--- a/packages/features/di/modules/NoSlotsNotification.ts
+++ b/packages/features/di/modules/NoSlotsNotification.ts
@@ -1,5 +1,5 @@
-import type { INoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
-import { NoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
+import type { INoSlotsNotificationService } from "@calcom/features/slots/handleNotificationWhenNoSlots";
+import { NoSlotsNotificationService } from "@calcom/features/slots/handleNotificationWhenNoSlots";
import { createModule } from "../di";
import { DI_TOKENS } from "../tokens";
diff --git a/packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts b/packages/features/slots/handleNotificationWhenNoSlots.test.ts
similarity index 98%
rename from packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts
rename to packages/features/slots/handleNotificationWhenNoSlots.test.ts
index 41943baa832..520c545638c 100644
--- a/packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.test.ts
+++ b/packages/features/slots/handleNotificationWhenNoSlots.test.ts
@@ -1,5 +1,5 @@
-import i18nMock from "../../../../../../tests/libs/__mocks__/libServerI18n";
-import prismaMock from "../../../../../../tests/libs/__mocks__/prismaMock";
+import i18nMock from "../../../tests/libs/__mocks__/libServerI18n";
+import prismaMock from "../../../tests/libs/__mocks__/prismaMock";
import { vi, describe, it, beforeAll, afterAll, expect, beforeEach, afterEach } from "vitest";
diff --git a/packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.ts b/packages/features/slots/handleNotificationWhenNoSlots.ts
similarity index 100%
rename from packages/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots.ts
rename to packages/features/slots/handleNotificationWhenNoSlots.ts
diff --git a/packages/platform/libraries/slots.ts b/packages/platform/libraries/slots.ts
index d3925543f21..f1d5f9a25f2 100644
--- a/packages/platform/libraries/slots.ts
+++ b/packages/platform/libraries/slots.ts
@@ -2,7 +2,7 @@ import { FilterHostsService } from "@calcom/features/bookings/lib/host-filtering
import { QualifiedHostsService } from "@calcom/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials";
import { BusyTimesService } from "@calcom/features/busyTimes/services/getBusyTimes";
import { validateRoundRobinSlotAvailability } from "@calcom/features/ee/round-robin/utils/validateRoundRobinSlotAvailability";
-import { NoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
+import { NoSlotsNotificationService } from "@calcom/features/slots/handleNotificationWhenNoSlots";
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
export { AvailableSlotsService };
diff --git a/packages/trpc/server/routers/viewer/slots/util.ts b/packages/trpc/server/routers/viewer/slots/util.ts
index 54325e3a3d8..fe9b5e73a6d 100644
--- a/packages/trpc/server/routers/viewer/slots/util.ts
+++ b/packages/trpc/server/routers/viewer/slots/util.ts
@@ -58,7 +58,7 @@ import type { CredentialForCalendarService } from "@calcom/types/Credential";
import { TRPCError } from "@trpc/server";
import type { TGetScheduleInputSchema } from "./getSchedule.schema";
-import type { NoSlotsNotificationService } from "./handleNotificationWhenNoSlots";
+import type { NoSlotsNotificationService } from "@calcom/features/slots/handleNotificationWhenNoSlots";
import type { GetScheduleOptions } from "./types";
const log = logger.getSubLogger({ prefix: ["[slots/util]"] });