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:
Morganandcubic-dev-ai[bot] authored and GitHub committed 2025-07-09 12:15:09 +01:00
1 parent 59b55e40b5
commit 7ada02177d
18 files changed
+1341 -1277

No files matched your search

@@ -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