Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
Delete participant and votes
Luke Vella2e468078460b
diff --git a/src/server/routers/polls/participants.ts b/src/server/routers/polls/participants.tsindex 094bc7675..628d9b048 100644--- a/src/server/routers/polls/participants.ts+++ b/src/server/routers/polls/participants.ts@@ -35,14 +35,19 @@ export const participants = createRouter()participantId: z.string(),}),resolve: async ({ input: { participantId, pollId } }) => {- await prisma.participant.delete({- where: {- id_pollId: {- id: participantId,- pollId: pollId,+ await prisma.$transaction([+ prisma.vote.deleteMany({+ where: { participantId: participantId },+ }),+ prisma.participant.delete({+ where: {+ id_pollId: {+ id: participantId,+ pollId: pollId,+ },},- },- });+ }),+ ]);},}).mutation("add", {