cal.pub0.org/packages/trpc/server/routers/viewer/slots/getSchedule.handler.ts

18 lines
557 B
TypeScript

import type { IncomingMessage } from "http";
import type { TGetScheduleInputSchema } from "./getSchedule.schema";
import { getAvailableSlots } from "./util";
export type GetScheduleOptions = {
ctx?: ContextForGetSchedule;
input: TGetScheduleInputSchema;
};
interface ContextForGetSchedule extends Record<string, unknown> {
req?: (IncomingMessage & { cookies: Partial<{ [key: string]: string }> }) | undefined;
}
export const getScheduleHandler = async ({ ctx, input }: GetScheduleOptions) => {
return await getAvailableSlots({ ctx, input });
};