update all deps
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import type { inferRouterOutputs } from "@trpc/server";
|
||||
import { router } from "../trpc";
|
||||
import type { inferReactQueryProcedureOptions } from "@trpc/react-query";
|
||||
import { projectRouter } from "./project";
|
||||
import { techStackRouter } from "./techStack";
|
||||
import { cvCategoryRouter } from "./cvCategory";
|
||||
import { cvEntryRouter } from "./cvEntry";
|
||||
import { trpcCrudRouterFromDrizzleEntity } from "../lib";
|
||||
import type { inferRouterMeta } from "@trpc/server/unstable-core-do-not-import";
|
||||
import { cvCategory } from "../dbschema/schema";
|
||||
|
||||
const { router : project } = trpcCrudRouterFromDrizzleEntity('project')
|
||||
const { router : techStack } = trpcCrudRouterFromDrizzleEntity('techStack')
|
||||
const { router : category } = trpcCrudRouterFromDrizzleEntity('cvCategory')
|
||||
const { router : entry } = trpcCrudRouterFromDrizzleEntity('cvEntry')
|
||||
export const trpcRouter = router({
|
||||
project: project,
|
||||
techStack: techStack,
|
||||
category: category,
|
||||
entry: entry
|
||||
})
|
||||
project: trpcCrudRouterFromDrizzleEntity('project').router,
|
||||
projectv2: projectRouter,
|
||||
techStack: trpcCrudRouterFromDrizzleEntity('techStack').router,
|
||||
techStackv2: techStackRouter,
|
||||
category: trpcCrudRouterFromDrizzleEntity('cvCategory').router,
|
||||
categoryv2: cvCategoryRouter,
|
||||
entry: trpcCrudRouterFromDrizzleEntity('cvEntry').router,
|
||||
entryv2: cvEntryRouter,
|
||||
});
|
||||
|
||||
export type TrpcRouter = typeof trpcRouter
|
||||
export type RouterOutputs = inferRouterOutputs<TrpcRouter>
|
||||
export type ReactQueryOptions = inferReactQueryProcedureOptions<TrpcRouter>
|
||||
export type TrpcRouter = typeof trpcRouter;
|
||||
export type RouterOutputs = inferRouterOutputs<TrpcRouter>;
|
||||
export type ReactQueryOptions = inferReactQueryProcedureOptions<TrpcRouter>;
|
||||
|
||||
34
src/server/routers/cvCategory.ts
Normal file
34
src/server/routers/cvCategory.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { publicProcedure, router } from "~/server/trpc";
|
||||
import { db } from "~/server/db";
|
||||
import { cvCategory } from "~/server/dbschema/schema";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { z } from 'zod';
|
||||
import { createInsertSchema, createUpdateSchema } from "drizzle-zod";
|
||||
import { TRPCError } from "@trpc/server";
|
||||
|
||||
export const cvCategoryRouter = router({
|
||||
listByLayoutPosition: publicProcedure.input(z.enum(cvCategory.layoutPosition.enumValues)).query(async ({input}) => {
|
||||
console.log(input);
|
||||
const res = await db.select().from(cvCategory).where(eq(cvCategory.layoutPosition,input));
|
||||
console.log(res);
|
||||
return res;
|
||||
}),
|
||||
getById: publicProcedure.input(z.string()).query(async ({input}) => {
|
||||
const res = await db.query.cvCategory.findFirst({
|
||||
with: {
|
||||
cvEntry: true
|
||||
},
|
||||
where(fields, operators) {
|
||||
return operators.eq(fields.id, input)
|
||||
},
|
||||
})
|
||||
return res;
|
||||
}),
|
||||
insert: publicProcedure.input(createInsertSchema(cvCategory)).mutation(async ({input}) => {
|
||||
let res = await db.insert(cvCategory).values(input).returning().execute();
|
||||
return res.at(0)
|
||||
}),
|
||||
updateById: publicProcedure.input(z.object({id: z.string(),data: createUpdateSchema(cvCategory)})).mutation(async ({input}) => {
|
||||
let res = await db.update(cvCategory).set(input.data).where(eq(cvCategory.id,input.id)).execute();
|
||||
})
|
||||
});
|
||||
16
src/server/routers/cvEntry.ts
Normal file
16
src/server/routers/cvEntry.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { publicProcedure, router } from "~/server/trpc";
|
||||
import { db } from "~/server/db";
|
||||
import { z } from 'zod';
|
||||
export const cvEntryRouter = router({
|
||||
getById: publicProcedure.input(z.string()).query(async ({input}) => {
|
||||
const res = await db.query.cvEntry.findFirst({
|
||||
with: {
|
||||
category: true
|
||||
},
|
||||
where(fields, operators) {
|
||||
return operators.eq(fields.id, input)
|
||||
},
|
||||
})
|
||||
return res;
|
||||
}),
|
||||
});
|
||||
4
src/server/routers/project.ts
Normal file
4
src/server/routers/project.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { router } from "~/server/trpc";
|
||||
|
||||
export const projectRouter = router({
|
||||
});
|
||||
5
src/server/routers/techStack.ts
Normal file
5
src/server/routers/techStack.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { router } from "~/server/trpc";
|
||||
|
||||
|
||||
export const techStackRouter = router({
|
||||
});
|
||||
Reference in New Issue
Block a user