Skip to content

Commit

Permalink
fix: update comment mutation to return a boolean
Browse files Browse the repository at this point in the history
- Changed the output of the comment mutation from a comment schema to a boolean, indicating success or failure.
- Removed the unnecessary return statement in the comment creation logic, streamlining the process.
- This change simplifies the response handling for comment creation, enhancing clarity in the API's behavior.
  • Loading branch information
blinko-space committed Jan 11, 2025
1 parent 985ee23 commit 3c7d7b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/routers/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const commentRouter = router({
noteId: z.number(),
parentId: z.number().optional(),
}))
.output(commentWithRelationsSchema)
.output(z.boolean())
.mutation(async function ({ input, ctx }) {
const { content, noteId, parentId } = input;

Expand Down Expand Up @@ -75,7 +75,7 @@ export const commentRouter = router({
AiService.AIComment({ content, noteId })
}

return await prisma.comments.create({
await prisma.comments.create({
data: {
content,
noteId,
Expand All @@ -96,6 +96,8 @@ export const commentRouter = router({
}
}
});

return true
}),

list: publicProcedure
Expand Down

0 comments on commit 3c7d7b9

Please sign in to comment.