|
@@ -25,13 +25,14 @@ const startChat = async (req, res, next) => {
|
|
|
const companion = await UserModel.findById(id);
|
|
|
const isUser = await ChatModel.getByField(id, userId);
|
|
|
const isCompanion = await ChatModel.getByField(userId, id);
|
|
|
- const { name, lastName, avatarUrl, color, online } = companion;
|
|
|
+ const { name, lastName, avatarUrl, color, online, number } = companion;
|
|
|
const {
|
|
|
name: Name,
|
|
|
lastName: LastName,
|
|
|
avatarUrl: AvatarUrl,
|
|
|
color: Color,
|
|
|
online: Online,
|
|
|
+ number: Number,
|
|
|
} = user;
|
|
|
if (companion && (isUser || isCompanion)) {
|
|
|
await ChatModel.update(isUser._id, {
|
|
@@ -40,6 +41,7 @@ const startChat = async (req, res, next) => {
|
|
|
avatarUrl,
|
|
|
color,
|
|
|
online,
|
|
|
+ number,
|
|
|
});
|
|
|
await ChatModel.update(isCompanion._id, {
|
|
|
name: Name,
|
|
@@ -47,6 +49,7 @@ const startChat = async (req, res, next) => {
|
|
|
avatarUrl: AvatarUrl,
|
|
|
color: Color,
|
|
|
online: Online,
|
|
|
+ number: Number,
|
|
|
});
|
|
|
const updatedChat = await ChatModel.getByField(id, userId);
|
|
|
return res.status(200).json({
|
|
@@ -63,6 +66,7 @@ const startChat = async (req, res, next) => {
|
|
|
avatarUrl,
|
|
|
color,
|
|
|
online,
|
|
|
+ number,
|
|
|
companionId: id,
|
|
|
owner: userId,
|
|
|
});
|
|
@@ -72,6 +76,7 @@ const startChat = async (req, res, next) => {
|
|
|
avatarUrl: AvatarUrl,
|
|
|
color: Color,
|
|
|
online: Online,
|
|
|
+ number: Number,
|
|
|
companionId: userId,
|
|
|
owner: id,
|
|
|
});
|