-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.ts
31 lines (26 loc) · 910 Bytes
/
post.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// import { z } from "zod";
// import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
// import { posts } from "~/server/db/schema";
// export const postRouter = createTRPCRouter({
// hello: publicProcedure
// .input(z.object({ text: z.string() }))
// .query(({ input }) => {
// return {
// greeting: `Hello ${input.text}`,
// };
// }),
// create: publicProcedure
// .input(z.object({ name: z.string().min(1) }))
// .mutation(async ({ ctx, input }) => {
// // simulate a slow db call
// await new Promise((resolve) => setTimeout(resolve, 1000));
// await ctx.db.insert(posts).values({
// name: input.name,
// });
// }),
// getLatest: publicProcedure.query(({ ctx }) => {
// return ctx.db.query.posts.findFirst({
// orderBy: (posts, { desc }) => [desc(posts.createdAt)],
// });
// }),
// });