mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-09 06:01:49 +02:00
Create guest users when creating a poll or comment
This commit is contained in:
parent
e1677059a6
commit
2cd7d5a581
2 changed files with 17 additions and 2 deletions
|
@ -171,6 +171,7 @@ export const polls = router({
|
|||
},
|
||||
create: {
|
||||
id: ctx.user.id,
|
||||
isGuest: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -39,9 +39,23 @@ export const comments = router({
|
|||
const newComment = await prisma.comment.create({
|
||||
data: {
|
||||
content,
|
||||
pollId,
|
||||
authorName,
|
||||
userId: ctx.user.id,
|
||||
poll: {
|
||||
connect: {
|
||||
id: pollId,
|
||||
},
|
||||
},
|
||||
user: {
|
||||
connectOrCreate: {
|
||||
where: {
|
||||
id: ctx.user.id,
|
||||
},
|
||||
create: {
|
||||
id: ctx.user.id,
|
||||
isGuest: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue