Prechádzať zdrojové kódy

work on unread messages

unknown 2 rokov pred
rodič
commit
e51272ea4c
2 zmenil súbory, kde vykonal 8 pridanie a 1 odobranie
  1. 4 1
      controllers/chats.js
  2. 4 0
      model/schemas/chat.js

+ 4 - 1
controllers/chats.js

@@ -205,7 +205,10 @@ const seenChat = async (req, res, next) => {
 				seen: total,
 				watched: false,
 			});
-			await ChatModel.update(isCompanionChat._id, id, { watched: true });
+			await ChatModel.update(isCompanionChat._id, id, {
+				watched: true,
+				seenCompanion: total,
+			});
 			return res.status(200).json({
 				status: 'success',
 				code: 200,

+ 4 - 0
model/schemas/chat.js

@@ -58,6 +58,10 @@ const chatSchema = new Schema(
 			type: Number,
 			default: 0,
 		},
+		seenCompanion: {
+			type: Number,
+			default: 0,
+		},
 		sort: {
 			type: Boolean,
 			default: false,