Skip to content

Commit

Permalink
test: added testing route
Browse files Browse the repository at this point in the history
  • Loading branch information
kujo205 committed Feb 5, 2024
1 parent 58e4fc5 commit 35e502c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/posts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
export default function Page() {
import { api } from "@/trpc/server";
export default async function Page() {
const resonse = await api.post.getPosts.query({
page: 1,
pageSize: 10,
tagIds: [1, 2, 3],
});

return (
<section>
{resonse.left}
<h1>Working on it cap</h1>
</section>
);
Expand Down
15 changes: 15 additions & 0 deletions src/server/api/routers/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ import {

// TODO: explore this code
export const postRouter = createTRPCRouter({
getPosts: publicProcedure
.input(
z.object({
page: z.number(),
pageSize: z.number(),
tagIds: z.array(z.number()),
}),
)
.query(({ input, ctx }) => {
return {
...input,
posts: [],
left: 0,
};
}),
hello: publicProcedure
.input(z.object({ text: z.string() }))
.query(({ input }) => {
Expand Down

0 comments on commit 35e502c

Please sign in to comment.