++ aggiunta la prenotazione negli eventi. con la lista degli utenti.

This commit is contained in:
Surya Paolo
2023-04-17 00:11:36 +02:00
parent eea6e63c58
commit 0945f1af08
22 changed files with 636 additions and 157 deletions

View File

@@ -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" },