_app.ts (735B)
1 import { z } from 'zod'; 2 3 import { createCallerFactory, procedure, router } from '../trpc'; 4 // import { prisma } from '../utils/prisma'; 5 6 import { classStandardRouter } from './classStandard'; 7 import { dayPeriodScheduleRouter } from './dayPeriodSchedule'; 8 9 export const appRouter = router({ 10 hello: procedure 11 .input(z.object({ text: z.string() }).optional()) 12 .query(({ input }) => { 13 return { 14 greeting: `hello ${input?.text}`, 15 }; 16 }), 17 classStandard: classStandardRouter, 18 dayPeriodSchedule: dayPeriodScheduleRouter, 19 }); 20 21 // export type definition of API 22 export type AppRouter = typeof appRouter; 23 24 const createCaller = createCallerFactory(appRouter); 25 export const caller = createCaller({ 26 // prisma, 27 req: undefined, 28 });