sdy

update newMessage.js

......@@ -47,18 +47,19 @@ export default {
if (!room) {
throw new Error("There is no room");
}
const toUser = await prisma.user.findOne({
where: {
id: receiverId,
},
});
const subMessage = await prisma.message.create({
data: {
text: message,
to: {
connect: {
id: receiverId,
},
connect: [{ id: toUser.id }],
},
from: {
connect: {
id: user.id,
},
connect: [{ id: user.id }],
},
room: {
connect: {
......@@ -67,7 +68,6 @@ export default {
},
},
});
console.log(subMessage);
pubsub.publish(ONE_TO_ONE_MESSAGE, subMessage);
return subMessage;
},
......