- Import emails from a list to a DB
- Create Template Emails - Options Email
This commit is contained in:
@@ -20,6 +20,9 @@ const MailingListSchema = new Schema({
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
hash: {
|
||||
type: String,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
trim: true,
|
||||
@@ -28,6 +31,10 @@ const MailingListSchema = new Schema({
|
||||
type: String,
|
||||
trim: true,
|
||||
},
|
||||
statesub: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
lastid_newstosent: {
|
||||
type: String
|
||||
}
|
||||
@@ -42,10 +49,10 @@ MailingListSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
MailingListSchema.statics.findAllIdApp = function (idapp) {
|
||||
MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
|
||||
const MailingList = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
const myfind = { idapp, statesub: true };
|
||||
|
||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||
|
||||
@@ -54,6 +61,38 @@ MailingListSchema.statics.findAllIdApp = function (idapp) {
|
||||
});
|
||||
};
|
||||
|
||||
MailingListSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const MailingList = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await MailingList.find(myfind, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
};
|
||||
|
||||
MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) {
|
||||
const MailingList = this;
|
||||
|
||||
let myperson = await MailingList.findOne({ idapp, hash });
|
||||
console.log('myperson', myperson);
|
||||
if (!!myperson) {
|
||||
return (!myperson.statesub)
|
||||
}
|
||||
};
|
||||
|
||||
MailingListSchema.statics.findByHash = function (idapp, hash) {
|
||||
const MailingList = this;
|
||||
|
||||
const myfind = { idapp, hash };
|
||||
|
||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||
|
||||
return MailingList.findOne(myfind, (err, rec) => {
|
||||
return rec
|
||||
});
|
||||
};
|
||||
|
||||
const MailingList = mongoose.model('MailingList', MailingListSchema);
|
||||
|
||||
module.exports = { MailingList };
|
||||
|
||||
Reference in New Issue
Block a user