Files
calendar/packages/trpc/server/routers/viewer/availability/schedule/get.handler.ts
T
Benny JooandGitHub 09a4247aa1 refactor: migrate schedule utils from TRPC to ScheduleRepository to break circular dependency (#24764)
* remove util files

* wip

* wip

* wip

* wip

* wip

* wip

* add test file

* refactors

* refactors

* fix type error

* simplify

* host repository test

* di
2025-12-10 12:01:48 +02:00

24 lines
733 B
TypeScript

import { ScheduleRepository } from "@calcom/features/schedules/repositories/ScheduleRepository";
import { prisma } from "@calcom/prisma";
import type { TrpcSessionUser } from "../../../../types";
import type { TGetInputSchema } from "./get.schema";
type GetOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TGetInputSchema;
};
export const getHandler = async ({ ctx, input }: GetOptions) => {
const scheduleRepo = new ScheduleRepository(prisma);
return await scheduleRepo.findDetailedScheduleById({
scheduleId: input.scheduleId,
isManagedEventType: input.isManagedEventType,
userId: ctx.user.id,
timeZone: ctx.user.timeZone,
defaultScheduleId: ctx.user.defaultScheduleId,
});
};