refactor: get available slots service (#22340)
* refactor: GetAvailableSlotsService * chore: add todo comments where DI is needed * chore: bump platform libs * chore: fix unit tests * fix: only instantiate AvailableSlotsService once per service * Update packages/trpc/server/routers/viewer/slots/util.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: bind this on all functions with reporting --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
59b55e40b5
commit
7ada02177d
18 files changed
+1341
-1277
No files matched your search
@@ -1,3 +1,3 @@
|
||||
import { getAvailableSlots } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
export { getAvailableSlots };
|
||||
export { AvailableSlotsService };
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IncomingMessage } from "http";
|
||||
|
||||
import { getAvailableSlots } from "../slots/util";
|
||||
import { AvailableSlotsService } from "../slots/util";
|
||||
import type { TGetTeamScheduleInputSchema } from "./getTeamSchedule.schema";
|
||||
|
||||
export type GetTeamScheduleOptions = {
|
||||
@@ -13,5 +13,6 @@ interface ContextForGetSchedule extends Record<string, unknown> {
|
||||
}
|
||||
|
||||
export const getTeamScheduleHandler = async ({ ctx, input }: GetTeamScheduleOptions) => {
|
||||
return await getAvailableSlots({ ctx, input });
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
return await availableSlotsService.getAvailableSlots({ ctx, input });
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { GetScheduleOptions } from "./types";
|
||||
import { getAvailableSlots } from "./util";
|
||||
import { AvailableSlotsService } from "./util";
|
||||
|
||||
export const getScheduleHandler = async ({ ctx, input }: GetScheduleOptions) => {
|
||||
return await getAvailableSlots({ ctx, input });
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
return await availableSlotsService.getAvailableSlots({ ctx, input });
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user