Step 2: Creating page Messages: userlist last messages + a page for all the messages received and sent.
This commit is contained in:
@@ -32,6 +32,12 @@ const sendmsgSchema = new Schema({
|
||||
datemsg: {
|
||||
type: Date,
|
||||
},
|
||||
status: {
|
||||
type: Number,
|
||||
},
|
||||
options: {
|
||||
type: Number,
|
||||
},
|
||||
read: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
@@ -53,7 +59,7 @@ sendmsgSchema.statics.findAllMsgByUsernameIdAndIdApp = function (username, lastd
|
||||
{ idapp }
|
||||
]
|
||||
}).then((arrmsg) => {
|
||||
console.log('arrmsg', arrmsg);
|
||||
console.log('arrmsg', arrmsg.length);
|
||||
return arrmsg
|
||||
}).catch((err) => {
|
||||
console.error('err', err);
|
||||
@@ -88,8 +94,12 @@ sendmsgSchema.statics.findLastGroupByUserIdAndIdApp = function (userId, username
|
||||
},
|
||||
])
|
||||
.then((arrmsg) => {
|
||||
console.table(arrmsg);
|
||||
return arrmsg
|
||||
// Remove duplicate
|
||||
// Exclude my chat
|
||||
const myarr = arrmsg.filter((ris) => ris._id !== username);
|
||||
console.table(myarr);
|
||||
return myarr
|
||||
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user