@@ -17,7 +17,7 @@ import {
|
||||
VERSION_2024_08_13,
|
||||
} from "@calcom/platform-constants";
|
||||
import { TRPCError } from "@calcom/platform-libraries";
|
||||
import { AvailableSlotsService } from "@calcom/platform-libraries/slots";
|
||||
import { getAvailableSlots } from "@calcom/platform-libraries/slots";
|
||||
import { RemoveSelectedSlotInput_2024_04_15, ReserveSlotInput_2024_04_15 } from "@calcom/platform-types";
|
||||
import { ApiResponse, GetAvailableSlotsInput_2024_04_15 } from "@calcom/platform-types";
|
||||
|
||||
@@ -170,10 +170,8 @@ export class SlotsController_2024_04_15 {
|
||||
: query.isTeamEvent;
|
||||
|
||||
// Do not use workers in E2E, not supported by TS-JEST
|
||||
const availableSlotsService = this.config.get<boolean>("e2e") ? new AvailableSlotsService() : null;
|
||||
|
||||
const availableSlots = availableSlotsService
|
||||
? await availableSlotsService.getAvailableSlots({
|
||||
const availableSlots = this.config.get<boolean>("e2e")
|
||||
? await getAvailableSlots({
|
||||
input: {
|
||||
...query,
|
||||
isTeamEvent,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { parentPort } from "worker_threads";
|
||||
|
||||
import { AvailableSlotsService } from "@calcom/platform-libraries/slots";
|
||||
import { getAvailableSlots } from "@calcom/platform-libraries/slots";
|
||||
|
||||
parentPort?.on("message", async (data) => {
|
||||
try {
|
||||
const { input, ctx } = data;
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
|
||||
const result = await availableSlotsService.getAvailableSlots({ input, ctx });
|
||||
const result = await getAvailableSlots({ input, ctx });
|
||||
parentPort?.postMessage({ success: true, data: result });
|
||||
} catch (error) {
|
||||
parentPort?.postMessage({
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { DateTime } from "luxon";
|
||||
import { z } from "zod";
|
||||
|
||||
import { AvailableSlotsService } from "@calcom/platform-libraries/slots";
|
||||
import { getAvailableSlots } from "@calcom/platform-libraries/slots";
|
||||
import { GetSlotsInput_2024_09_04, ReserveSlotInput_2024_09_04 } from "@calcom/platform-types";
|
||||
import { Booking, EventType } from "@calcom/prisma/client";
|
||||
|
||||
@@ -31,8 +31,6 @@ const DEFAULT_RESERVATION_DURATION = 5;
|
||||
|
||||
@Injectable()
|
||||
export class SlotsService_2024_09_04 {
|
||||
private readonly availableSlotsService: AvailableSlotsService;
|
||||
|
||||
constructor(
|
||||
private readonly eventTypeRepository: EventTypesRepository_2024_06_14,
|
||||
private readonly slotsRepository: SlotsRepository_2024_09_04,
|
||||
@@ -41,14 +39,12 @@ export class SlotsService_2024_09_04 {
|
||||
private readonly membershipsService: MembershipsService,
|
||||
private readonly membershipsRepository: MembershipsRepository,
|
||||
private readonly teamsRepository: TeamsRepository
|
||||
) {
|
||||
this.availableSlotsService = new AvailableSlotsService();
|
||||
}
|
||||
) {}
|
||||
|
||||
async getAvailableSlots(query: GetSlotsInput_2024_09_04) {
|
||||
try {
|
||||
const queryTransformed = await this.slotsInputService.transformGetSlotsQuery(query);
|
||||
const availableSlots: TimeSlots = await this.availableSlotsService.getAvailableSlots({
|
||||
const availableSlots: TimeSlots = await getAvailableSlots({
|
||||
input: {
|
||||
...queryTransformed,
|
||||
routingFormResponseId: queryTransformed.routingFormResponseId ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user