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
@@ -8,7 +8,7 @@ import type { TGetRetellLLMSchema } from "@calcom/features/ee/cal-ai-phone/zod-u
|
||||
import { fetcher } from "@calcom/lib/retellAIFetcher";
|
||||
import { defaultHandler } from "@calcom/lib/server/defaultHandler";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { getAvailableSlots } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
@@ -86,8 +86,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const startTime = now.startOf("month").toISOString();
|
||||
const endTime = now.add(2, "month").endOf("month").toISOString();
|
||||
const orgSlug = eventType?.team?.parent?.slug ?? null;
|
||||
const availableSlotsService = new AvailableSlotsService();
|
||||
|
||||
const availableSlots = await getAvailableSlots({
|
||||
const availableSlots = await availableSlotsService.getAvailableSlots({
|
||||
input: {
|
||||
startTime,
|
||||
endTime,
|
||||
|
||||
Reference in new issue
Block a user