import { initTRPC } from "@trpc/server";
import { v4 } from "uuid";
import typia from "typia";
import { IBbsArticle } from "../structures/IBbsArticle";
const server = initTRPC.create();
export const appRouter = server.router({
store: server.procedure
.input(typia.createAssert<IBbsArticle.IStore>())
.output(typia.createAssert<IBbsArticle>())
.query(({ input }) => {
return {
id: v4(),
writer: input.writer,
title: input.title,
body: input.body,
created_at: new Date().toString(),
};
}),
});
export type AppRouter = typeof appRouter;