Recap
To recap, we have added a new feature to the application, which is replying to posts.
- We updated the Prisma schema to add new
parent
andreplies
relations to thePost
model. - We ran the migration to update the database.
- A tRPC
thread
subrouter was created for this feature, and the new router was added to the application router. - The
reply
mutation procedure was added to thethread
subrouter, and the procedure's input was validated usingzod
. - The new procedure can automatically be used in the client application using the
trpc.thread.reply.useMutation()
hook that was automatically exposed by tRPC. - The input data can be validated using
zod
andreact-hook-form
before the mutation was called.