- Import emails from a list to a DB
- Create Template Emails - Options Email
This commit is contained in:
@@ -120,12 +120,38 @@ MyEventSchema.statics.getLastEvents = function (idapp) {
|
||||
|
||||
const query = [
|
||||
{ $match: { idapp } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher',
|
||||
foreignField: 'username',
|
||||
as: 'op1'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher2',
|
||||
foreignField: 'username',
|
||||
as: 'op2'
|
||||
}
|
||||
},
|
||||
{ "$addFields": { "contribtype": { "$toObjectId": "$contribtype" } } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'contribtypes',
|
||||
localField: 'contribtype',
|
||||
foreignField: '_id',
|
||||
as: 'contrib'
|
||||
}
|
||||
},
|
||||
{ $sort: { dateTimeStart: 1 } }
|
||||
];
|
||||
|
||||
return Event
|
||||
.aggregate(query)
|
||||
.then((arrrec) => {
|
||||
// console.table(arrrec);
|
||||
return arrrec.slice(-lastn)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user