|
@@ -96,7 +96,7 @@ const updateContact = async (req, res, next) => {
|
|
|
try {
|
|
|
const { id, _id, name, lastName, companionId } = req.body;
|
|
|
const userId = req.user.id;
|
|
|
- const chat = await ChatModel.getByField(companionId, userId);
|
|
|
+ const userChat = await ChatModel.getByField(companionId, userId);
|
|
|
await ContactModel.update(id, userId, { name, lastName });
|
|
|
await ChatModel.update(_id, userId, { name, lastName });
|
|
|
await MessageModel.updateOwnerMessages(
|
|
@@ -106,8 +106,8 @@ const updateContact = async (req, res, next) => {
|
|
|
await MessageModel.updateOwnerMessages(
|
|
|
{
|
|
|
companionId,
|
|
|
- replyName: { $eq: chat.name },
|
|
|
- replyLastName: { $eq: chat.lastName },
|
|
|
+ replyName: { $eq: userChat.name },
|
|
|
+ replyLastName: { $eq: userChat.lastName },
|
|
|
owner: userId,
|
|
|
},
|
|
|
{ replyName: name, replyLastName: lastName }
|