🐛 Fix query after removing unique index

This commit is contained in:
Luke Vella 2023-03-18 13:11:21 +00:00
parent 7f9214daa1
commit 0ed12b91dc
2 changed files with 4 additions and 9 deletions

View file

@ -112,7 +112,7 @@ const Discussion: React.FunctionComponent = () => {
{dayjs(new Date(comment.createdAt)).fromNow()} {dayjs(new Date(comment.createdAt)).fromNow()}
</span> </span>
</div> </div>
{canDelete && {canDelete && (
<Dropdown <Dropdown
placement="bottom-start" placement="bottom-start"
trigger={<CompactButton icon={DotsHorizontal} />} trigger={<CompactButton icon={DotsHorizontal} />}
@ -123,12 +123,11 @@ const Discussion: React.FunctionComponent = () => {
onClick={() => { onClick={() => {
deleteComment.mutate({ deleteComment.mutate({
commentId: comment.id, commentId: comment.id,
pollId,
}); });
}} }}
/> />
</Dropdown> </Dropdown>
} )}
</div> </div>
<div className="w-fit whitespace-pre-wrap"> <div className="w-fit whitespace-pre-wrap">
<TruncatedLinkify>{comment.content}</TruncatedLinkify> <TruncatedLinkify>{comment.content}</TruncatedLinkify>

View file

@ -51,17 +51,13 @@ export const comments = router({
delete: publicProcedure delete: publicProcedure
.input( .input(
z.object({ z.object({
pollId: z.string(),
commentId: z.string(), commentId: z.string(),
}), }),
) )
.mutation(async ({ input: { pollId, commentId } }) => { .mutation(async ({ input: { commentId } }) => {
await prisma.comment.delete({ await prisma.comment.delete({
where: { where: {
id_pollId: { id: commentId,
id: commentId,
pollId,
},
}, },
}); });
}), }),