export const postRouter = createTRPCRouter({
create: protectedProcedure
.input(
z.object({
text: z.string().emoji().min(1),
})
)
.mutation(async ({ ctx, input }) => {
const authorId = ctx.session.user.id;
const post = await ctx.prisma.post.create({
data: {
authorId,
text: input.text,
},
});
return post;
}),
});
export const postRouter = createTRPCRouter({
create: protectedProcedure
.input(
z.object({
text: z.string().emoji().min(1),
})
)
.mutation(async ({ ctx, input }) => {
const authorId = ctx.session.user.id;
const post = await ctx.prisma.post.create({
data: {
authorId,
text: input.text,
},
});
return post;
}),
});