trpc demo

This commit is contained in:
2025-04-12 01:49:57 +02:00
parent 41059d9396
commit 10d1c91dea
15 changed files with 255 additions and 30 deletions

View File

@@ -0,0 +1,10 @@
import { router } from "../trpc";
import { CvCategoryRouter } from "./cvCategory";
import { publicProcedure } from "~/server/trpc";
export const trpcRouter = router({
hello: publicProcedure.query(async () => "world"),
cvCategory: CvCategoryRouter
})
export type TrpcRouter = typeof trpcRouter

View File

@@ -0,0 +1,12 @@
import { db } from "~/server/db";
import { publicProcedure, router } from "~/server/trpc";
export const CvCategoryRouter = router({
get: publicProcedure.query(async () => {
const categories = await db.query.cvCategory.findMany({
orderBy: (model, {desc} ) => desc(model.name)
});
return categories;
})
})