|
@@ -75,7 +75,7 @@ const sentMessage = async (req, res, next) => {
|
|
{ owner: userId, companionId: id },
|
|
{ owner: userId, companionId: id },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
total,
|
|
total,
|
|
seen: total,
|
|
seen: total,
|
|
watched: false,
|
|
watched: false,
|
|
@@ -86,7 +86,7 @@ const sentMessage = async (req, res, next) => {
|
|
{ owner: id, companionId: userId },
|
|
{ owner: id, companionId: userId },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isCompanionChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isCompanionChat._id, id, {
|
|
total: Total,
|
|
total: Total,
|
|
lastMessage: message,
|
|
lastMessage: message,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
@@ -146,7 +146,7 @@ const imageMessage = async (req, res, next) => {
|
|
{ owner: userId, companionId: id },
|
|
{ owner: userId, companionId: id },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
total,
|
|
total,
|
|
seen: total,
|
|
seen: total,
|
|
watched: false,
|
|
watched: false,
|
|
@@ -157,7 +157,7 @@ const imageMessage = async (req, res, next) => {
|
|
{ owner: id, companionId: userId },
|
|
{ owner: id, companionId: userId },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isCompanionChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isCompanionChat._id, id, {
|
|
total: Total,
|
|
total: Total,
|
|
lastMessage: imgUrl,
|
|
lastMessage: imgUrl,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
@@ -216,7 +216,7 @@ const audioMessage = async (req, res, next) => {
|
|
{ owner: userId, companionId: id },
|
|
{ owner: userId, companionId: id },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
total,
|
|
total,
|
|
seen: total,
|
|
seen: total,
|
|
watched: false,
|
|
watched: false,
|
|
@@ -227,7 +227,7 @@ const audioMessage = async (req, res, next) => {
|
|
{ owner: id, companionId: userId },
|
|
{ owner: id, companionId: userId },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isCompanionChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isCompanionChat._id, id, {
|
|
total: Total,
|
|
total: Total,
|
|
lastMessage: audioUrl,
|
|
lastMessage: audioUrl,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
@@ -286,7 +286,7 @@ const videoMessage = async (req, res, next) => {
|
|
{ owner: userId, companionId: id },
|
|
{ owner: userId, companionId: id },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
total,
|
|
total,
|
|
seen: total,
|
|
seen: total,
|
|
watched: false,
|
|
watched: false,
|
|
@@ -297,7 +297,7 @@ const videoMessage = async (req, res, next) => {
|
|
{ owner: id, companionId: userId },
|
|
{ owner: id, companionId: userId },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isCompanionChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isCompanionChat._id, id, {
|
|
total: Total,
|
|
total: Total,
|
|
lastMessage: videoUrl,
|
|
lastMessage: videoUrl,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
@@ -370,7 +370,7 @@ const fileMessage = async (req, res, next) => {
|
|
{ owner: userId, companionId: id },
|
|
{ owner: userId, companionId: id },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isChat._id, userId, {
|
|
total,
|
|
total,
|
|
seen: total,
|
|
seen: total,
|
|
watched: false,
|
|
watched: false,
|
|
@@ -381,7 +381,7 @@ const fileMessage = async (req, res, next) => {
|
|
{ owner: id, companionId: userId },
|
|
{ owner: id, companionId: userId },
|
|
{}
|
|
{}
|
|
);
|
|
);
|
|
- await ChatModel.update(isCompanionChat._id, {
|
|
|
|
|
|
+ await ChatModel.update(isCompanionChat._id, id, {
|
|
total: Total,
|
|
total: Total,
|
|
lastMessage: fileUrl,
|
|
lastMessage: fileUrl,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|
|
lastMessageCreatedAt: newMessage.createdAt,
|