23 lines
513 B
TypeScript
23 lines
513 B
TypeScript
import { initTRPC } from "@trpc/server";
|
|
import type { db } from "@lifetracker/db";
|
|
|
|
const t = initTRPC.create();
|
|
export const router = t.router;
|
|
export const publicProcedure = t.procedure;
|
|
|
|
export const createCallerFactory = t.createCallerFactory;
|
|
|
|
|
|
interface User {
|
|
id: string;
|
|
name?: string | null | undefined;
|
|
email?: string | null | undefined;
|
|
role: "admin" | "user" | null;
|
|
}
|
|
export interface Context {
|
|
user: User | null;
|
|
db: typeof db;
|
|
req: {
|
|
ip: string | null;
|
|
};
|
|
} |