chore: DI repositories in AvailableSlotsService class (#22356)
* chore: DI available slots service repositories * remove configService from worker module * register scheduleRepo in availableSlotsModule * chore: bump platform libs * remove useless comment from prisma module * fix: availableSlotsModule to class deps * fix: repositoriesModule deps * chore: container pattern * refactor: move modules in DI folder * fixup! refactor: move modules in DI folder
This commit is contained in:
1 parent
db84343581
commit
5c508bce6d
32 files changed
+266
-59
No files matched your search
@@ -16,8 +16,8 @@ import {
|
||||
import { describe, vi, test } from "vitest";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
import { SchedulingType, type BookingStatus } from "@calcom/prisma/enums";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { expect, expectedSlotsForSchedule } from "./getSchedule/expects";
|
||||
import { setupAndTeardown } from "./getSchedule/setupAndTeardown";
|
||||
@@ -31,7 +31,7 @@ vi.mock("@calcom/lib/constants", () => ({
|
||||
}));
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
|
||||
// TODO: Move these inside describe('Team Event')
|
||||
|
||||
@@ -9,13 +9,13 @@ import {
|
||||
|
||||
import { describe, test } from "vitest";
|
||||
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
|
||||
import { expect, expectedSlotsForSchedule } from "./expects";
|
||||
import { setupAndTeardown } from "./setupAndTeardown";
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
describe("Calendar event", () => {
|
||||
test("correctly identifies unavailable slots from selected calendars at user level", async () => {
|
||||
|
||||
@@ -12,13 +12,14 @@ import { expectNoAttemptToGetAvailability } from "../../utils/bookingScenario/ex
|
||||
|
||||
import { describe, test } from "vitest";
|
||||
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { expect, expectedSlotsForSchedule } from "./expects";
|
||||
import { setupAndTeardown } from "./setupAndTeardown";
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
|
||||
describe("Delegation Credential", () => {
|
||||
@@ -90,7 +91,6 @@ describe("getSchedule", () => {
|
||||
};
|
||||
|
||||
await createBookingScenario(scenarioData);
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const scheduleForDayWithAGoogleCalendarBooking = await availableSlotsService.getAvailableSlots({
|
||||
input: {
|
||||
eventTypeId: 1,
|
||||
@@ -182,7 +182,6 @@ describe("getSchedule", () => {
|
||||
};
|
||||
|
||||
await createBookingScenario(scenarioData);
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const scheduleForDayWithAGoogleCalendarBooking = await availableSlotsService.getAvailableSlots({
|
||||
input: {
|
||||
eventTypeId: 1,
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { ScenarioData } from "../../utils/bookingScenario/bookingScenario";
|
||||
|
||||
import { describe, expect, vi, test } from "vitest";
|
||||
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
import { PeriodType } from "@calcom/prisma/enums";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { expectedSlotsForSchedule } from "./expects";
|
||||
import { setupAndTeardown } from "./setupAndTeardown";
|
||||
@@ -70,7 +70,7 @@ vi.mock("@calcom/lib/constants", () => ({
|
||||
}));
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
describe("Future Limits", () => {
|
||||
describe("PeriodType=ROLLING", () => {
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
import { describe, test, vi } from "vitest";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
import type { getScheduleSchema } from "@calcom/trpc/server/routers/viewer/slots/types";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { expect } from "./expects";
|
||||
import { setupAndTeardown } from "./setupAndTeardown";
|
||||
@@ -89,7 +89,7 @@ async function setupTeamAndFeatures() {
|
||||
}
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
|
||||
describe("Restriction Schedule", () => {
|
||||
|
||||
@@ -10,9 +10,9 @@ import type { IncomingMessage } from "http";
|
||||
import { describe, test, beforeEach, vi } from "vitest";
|
||||
import type { z } from "zod";
|
||||
|
||||
import { getAvailableSlotsService } from "@calcom/lib/di/containers/available-slots";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { getScheduleSchema, GetScheduleOptions } from "@calcom/trpc/server/routers/viewer/slots/types";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
import { expect } from "./expects";
|
||||
import { setupAndTeardown } from "./setupAndTeardown";
|
||||
@@ -62,7 +62,7 @@ const getBaseScenarioData = (): ScheduleScenario => ({
|
||||
});
|
||||
|
||||
describe("getSchedule", () => {
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
const availableSlotsService = getAvailableSlotsService();
|
||||
setupAndTeardown();
|
||||
|
||||
describe("Reserved Slots", () => {
|
||||
|
||||
Reference in new issue
Block a user