- Import emails from a list to a DB

- Create Template Emails
- Options Email
This commit is contained in:
Paolo Arena
2019-12-04 02:03:44 +01:00
parent f7fa0c4909
commit 6adeb32d46
19 changed files with 1061 additions and 211 deletions

View File

@@ -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)
})