mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-24 14:26:23 +02:00
🐛 Fix query after removing unique index
This commit is contained in:
parent
7f9214daa1
commit
0ed12b91dc
2 changed files with 4 additions and 9 deletions
|
@ -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>
|
||||||
|
|
|
@ -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,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue