Files
calendar/packages/trpc/server/routers/viewer/availability/schedule/get.handler.ts
T
Benny JooandGitHub d9777a3011 perf: Server-Side Data Fetching in App Router: /availability (#16536)
* wip

* add method to OrganizationRepository

* server side fetching for availability

* fix error

* server side fetching finish

* remove log

* fix

* fix

* fix type

* no need to export

* fix type

* address nit comments
2024-09-10 19:23:42 -07:00

22 lines
622 B
TypeScript

import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
import type { TrpcSessionUser } from "../../../../trpc";
import type { TGetInputSchema } from "./get.schema";
type GetOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TGetInputSchema;
};
export const getHandler = async ({ ctx, input }: GetOptions) => {
return await ScheduleRepository.findDetailedScheduleById({
scheduleId: input.scheduleId,
isManagedEventType: input.isManagedEventType,
userId: ctx.user.id,
timeZone: ctx.user.timeZone,
defaultScheduleId: ctx.user.defaultScheduleId,
});
};