refactor(api): extract holiday calendar catalog reads

This commit is contained in:
2026-03-31 09:05:18 +02:00
parent a23ef2c8b5
commit 5ff76e6aa2
3 changed files with 232 additions and 229 deletions
@@ -0,0 +1,25 @@
import type { TRPCContext } from "../trpc.js";
export type HolidayReadContext = Pick<TRPCContext, "db" | "dbUser">;
export type HolidayCalendarDb = TRPCContext["db"] & {
holidayCalendar: {
findFirst: (args: unknown) => Promise<{ id: string } | null>;
findMany: (args: unknown) => Promise<any[]>;
findUnique: (args: unknown) => Promise<any | null>;
create: (args: unknown) => Promise<any>;
update: (args: unknown) => Promise<any>;
delete: (args: unknown) => Promise<any>;
};
holidayCalendarEntry: {
findFirst: (args: unknown) => Promise<{ id: string } | null>;
findUnique: (args: unknown) => Promise<any | null>;
create: (args: unknown) => Promise<any>;
update: (args: unknown) => Promise<any>;
delete: (args: unknown) => Promise<any>;
};
};
export function asHolidayCalendarDb(db: TRPCContext["db"]): HolidayCalendarDb {
return db as unknown as HolidayCalendarDb;
}