var path = require('path'); var database = require(path.join(__dirname, '../../database.js')); var locale = require(path.join(__dirname, '../../locale.js')); module.exports = class NotificationAlias { getData(params, cb) { this.params = params; let query = `SELECT alias, CONCAT(alias, '@verdnatura.es') AS recipient FROM account.mailAlias WHERE alias = ?`; database.pool.query(query, [params.alias], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); Object.assign(this, result[0]); cb(); }); } get subject() { return this._.notificationCode[this.params.code].subject; } get message() { return locale.parseText(this._.notificationCode[this.params.code].message, this.params.bodyParams); } };