++ aggiunta la prenotazione negli eventi. con la lista degli utenti.
This commit is contained in:
@@ -17,14 +17,14 @@ const sendmsgSchema = new Schema({
|
||||
},
|
||||
source: {
|
||||
page: { type: String },
|
||||
event_id: { type: String }
|
||||
event_id: { type: String },
|
||||
infoevent: { type: String }
|
||||
},
|
||||
origin: {
|
||||
username: { type: String },
|
||||
type: String,
|
||||
},
|
||||
dest: {
|
||||
idapp: { type: String, },
|
||||
username: { type: String },
|
||||
type: String,
|
||||
},
|
||||
message: {
|
||||
type: String,
|
||||
@@ -54,7 +54,7 @@ sendmsgSchema.statics.findAllMsgByUsernameIdAndIdApp = function (username, lastd
|
||||
|
||||
return SendMsg.find({
|
||||
$and: [
|
||||
{ $or: [ { 'dest.username': username }, { 'origin.username': username },] },
|
||||
{ $or: [ { 'dest': username }, { 'origin': username },] },
|
||||
{ 'datemsg': {$gt: new Date(lastdataread)} },
|
||||
{ idapp }
|
||||
]
|
||||
@@ -73,14 +73,14 @@ sendmsgSchema.statics.findLastGroupByUserIdAndIdApp = function (userId, username
|
||||
return SendMsg.aggregate([
|
||||
{
|
||||
$match: {
|
||||
$or: [{ 'origin.username': username }, { 'dest.username': username }, { idapp }],
|
||||
$or: [{ 'origin': username }, { 'dest': username }, { idapp }],
|
||||
$and: [{ idapp }]
|
||||
}
|
||||
},
|
||||
{
|
||||
$group:
|
||||
{
|
||||
_id: "$dest.username",
|
||||
_id: "$dest",
|
||||
message: { $last: "$message" },
|
||||
datemsg: { $last: "$datemsg" },
|
||||
dest: { $last: "$dest" },
|
||||
|
||||
Reference in New Issue
Block a user