mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-05 20:21:50 +02:00
🐛 Fix gateway timeout when poll has 55 options (#1238)
This commit is contained in:
parent
0daa9dc494
commit
02f7c3ac06
4 changed files with 58 additions and 54 deletions
|
@ -91,22 +91,26 @@ export const participants = router({
|
|||
throw new TRPCError({ code: "BAD_REQUEST", message: "Poll not found" });
|
||||
}
|
||||
|
||||
const participant = await prisma.participant.create({
|
||||
data: {
|
||||
pollId: pollId,
|
||||
name: name,
|
||||
email,
|
||||
userId: user.id,
|
||||
votes: {
|
||||
createMany: {
|
||||
data: votes.map(({ optionId, type }) => ({
|
||||
optionId,
|
||||
type,
|
||||
pollId: pollId,
|
||||
})),
|
||||
},
|
||||
const participant = await prisma.$transaction(async (prisma) => {
|
||||
const participant = await prisma.participant.create({
|
||||
data: {
|
||||
pollId: pollId,
|
||||
name: name,
|
||||
email,
|
||||
userId: user.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.vote.createMany({
|
||||
data: votes.map(({ optionId, type }) => ({
|
||||
optionId,
|
||||
type,
|
||||
pollId,
|
||||
participantId: participant.id,
|
||||
})),
|
||||
});
|
||||
|
||||
return participant;
|
||||
});
|
||||
|
||||
const emailsToSend: Promise<void>[] = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue