ubiquitous-invention/apps/web/server/routers/health.ts

20 lines
425 B
TypeScript
Raw Normal View History

import {
router,
publicProcedure,
protectedProcedure,
} from "@/server/trpc";
export const healthRouter = router({
ping: publicProcedure.query(() => ({
status: "ok" as const,
timestamp: new Date(),
})),
me: protectedProcedure.query(({ ctx }) => ctx.session!.user),
dbCheck: protectedProcedure.query(async ({ ctx }) => {
await ctx.db.$client`SELECT 1`;
return { ok: true as const };
}),
});