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

View file

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