refactor(api): extract holiday calendar catalog reads
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user