Showing
1 changed file
with
7 additions
and
7 deletions
... | @@ -47,18 +47,19 @@ export default { | ... | @@ -47,18 +47,19 @@ export default { |
47 | if (!room) { | 47 | if (!room) { |
48 | throw new Error("There is no room"); | 48 | throw new Error("There is no room"); |
49 | } | 49 | } |
50 | + const toUser = await prisma.user.findOne({ | ||
51 | + where: { | ||
52 | + id: receiverId, | ||
53 | + }, | ||
54 | + }); | ||
50 | const subMessage = await prisma.message.create({ | 55 | const subMessage = await prisma.message.create({ |
51 | data: { | 56 | data: { |
52 | text: message, | 57 | text: message, |
53 | to: { | 58 | to: { |
54 | - connect: { | 59 | + connect: [{ id: toUser.id }], |
55 | - id: receiverId, | ||
56 | - }, | ||
57 | }, | 60 | }, |
58 | from: { | 61 | from: { |
59 | - connect: { | 62 | + connect: [{ id: user.id }], |
60 | - id: user.id, | ||
61 | - }, | ||
62 | }, | 63 | }, |
63 | room: { | 64 | room: { |
64 | connect: { | 65 | connect: { |
... | @@ -67,7 +68,6 @@ export default { | ... | @@ -67,7 +68,6 @@ export default { |
67 | }, | 68 | }, |
68 | }, | 69 | }, |
69 | }); | 70 | }); |
70 | - console.log(subMessage); | ||
71 | pubsub.publish(ONE_TO_ONE_MESSAGE, subMessage); | 71 | pubsub.publish(ONE_TO_ONE_MESSAGE, subMessage); |
72 | return subMessage; | 72 | return subMessage; |
73 | }, | 73 | }, | ... | ... |
-
Please register or login to post a comment