diff --git a/back/methods/notification/send.js b/back/methods/notification/send.js index 35fbc5105..93e2cf5fd 100644 --- a/back/methods/notification/send.js +++ b/back/methods/notification/send.js @@ -27,7 +27,7 @@ module.exports = Self => { { relation: 'notification', scope: { - include: [{ + include: { relation: 'subscription', scope: { include: { @@ -40,10 +40,7 @@ module.exports = Self => { } } }, - }, { - relation: 'notificationTemplate', - fields: ['id'] - }] + } } }] @@ -58,7 +55,7 @@ module.exports = Self => { for (const notificationUser of queue.notification().subscription()) { try { const sendParams = { - recipient: 'pablone.verdnatura@gmail.com', + recipient: notificationUser.user().emailUser().email, lang: notificationUser.user().lang }; diff --git a/back/model-config.json b/back/model-config.json index 5144b1724..ebc0e321b 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -103,9 +103,6 @@ "NotificationSubscription": { "dataSource": "vn" }, - "NotificationTemplate": { - "dataSource": "vn" - }, "Province": { "dataSource": "vn" }, diff --git a/back/models/notification.json b/back/models/notification.json index 18cc00cb6..56f66bf1d 100644 --- a/back/models/notification.json +++ b/back/models/notification.json @@ -25,11 +25,6 @@ "type": "hasMany", "model": "NotificationSubscription", "foreignKey": "notificationFk" - }, - "notificationTemplate": { - "type": "belongsTo", - "model": "NotificationTemplate", - "foreignKey": "templateFk" } } } \ No newline at end of file diff --git a/back/models/notificationTemplate.json b/back/models/notificationTemplate.json deleted file mode 100644 index b43bb49e0..000000000 --- a/back/models/notificationTemplate.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "NotificationTemplate", - "base": "VnModel", - "options": { - "mysql": { - "table": "util.notificationTemplate" - } - }, - "properties": { - "id": { - "type": "number", - "id": true, - "description": "Identifier" - }, - "code": { - "type": "string", - "required": true - }, - "description": { - "type": "string", - "required": true - } - } -} \ No newline at end of file diff --git a/db/changes/240201/00-NotificationTemplate.sql b/db/changes/240201/00-NotificationTemplate.sql deleted file mode 100644 index f6b978a5c..000000000 --- a/db/changes/240201/00-NotificationTemplate.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE IF NOT EXISTS `util`.`notificationTemplate` ( - `id` int unsigned auto_increment NULL, - `code` varchar(100) NOT NULL, - description varchar(100) NOT NULL, - CONSTRAINT `notificationTemplate_PK` PRIMARY KEY (`id`), - CONSTRAINT `notificationTemplate_UN` UNIQUE KEY (`code`) -) -ENGINE=InnoDB -DEFAULT CHARSET=utf8mb3 -COLLATE=utf8mb3_unicode_ci; - -ALTER TABLE `util`.`notification` ADD templateFk int unsigned NULL; -ALTER TABLE `util`.`notification` ADD CONSTRAINT notification_notificationTemplate_FK - FOREIGN KEY (templateFk) REFERENCES util.notificationTemplate(id); - diff --git a/print/core/email.js b/print/core/email.js index e7200463a..526adbfc7 100644 --- a/print/core/email.js +++ b/print/core/email.js @@ -18,7 +18,6 @@ class Email extends Component { } async getSubject() { - if (this.args.subject) return this.args.subject; return (await this.getUserLocale())['subject']; } diff --git a/print/templates/email/aaaPrExample/aaaPrExample.js b/print/templates/email/aaaPrExample/aaaPrExample.js new file mode 100644 index 000000000..b09ff38dc --- /dev/null +++ b/print/templates/email/aaaPrExample/aaaPrExample.js @@ -0,0 +1,21 @@ + +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); +module.exports = { + name: 'blank-notification', + components: { + 'email-body': emailBody.build() + }, + props: { + subject: { + type: String + }, + title: { + type: String, + required: true + }, + text: { + type: String + } + } +}; diff --git a/print/templates/email/aaaPrExample/locale/en.yml b/print/templates/email/aaaPrExample/locale/en.yml new file mode 100644 index 000000000..5a2aa7b27 --- /dev/null +++ b/print/templates/email/aaaPrExample/locale/en.yml @@ -0,0 +1,3 @@ +subject: Asunto +title: Titulo +text: Texto \ No newline at end of file