mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-18 18:41:51 +02:00
Create guest user in user table when creating a participant
This commit is contained in:
parent
346ef136f0
commit
65192f95c9
5 changed files with 20 additions and 7 deletions
|
@ -92,9 +92,14 @@ export const participants = router({
|
|||
|
||||
const participant = await prisma.participant.create({
|
||||
data: {
|
||||
pollId: pollId,
|
||||
name: name,
|
||||
email,
|
||||
locale: user.locale ?? undefined,
|
||||
poll: {
|
||||
connect: {
|
||||
id: pollId,
|
||||
},
|
||||
},
|
||||
user: {
|
||||
connectOrCreate: {
|
||||
where: {
|
||||
|
@ -102,12 +107,15 @@ export const participants = router({
|
|||
},
|
||||
create: {
|
||||
id: user.id,
|
||||
isGuest: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
locale: user.locale ?? undefined,
|
||||
},
|
||||
include: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
email: true,
|
||||
poll: {
|
||||
select: {
|
||||
id: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue