Soft delete participants (#1193)

This commit is contained in:
Luke Vella 2024-07-04 10:03:09 +01:00 committed by GitHub
parent 8384128246
commit 6df4405cf4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View file

@ -18,6 +18,7 @@ export const participants = router({
const participants = await prisma.participant.findMany({
where: {
pollId,
deleted: false,
},
include: {
votes: {
@ -43,10 +44,14 @@ export const participants = router({
}),
)
.mutation(async ({ input: { participantId } }) => {
await prisma.participant.delete({
await prisma.participant.update({
where: {
id: participantId,
},
data: {
deleted: true,
deletedAt: new Date(),
},
});
}),
add: publicProcedure