WIP: 6367-blankNotification #1903

Draft
pablone wants to merge 11 commits from 6367-blankNotification into dev
8 changed files with 27 additions and 54 deletions
Showing only changes of commit ccb037da06 - Show all commits

View File

@ -27,7 +27,7 @@ module.exports = Self => {
{ {
relation: 'notification', relation: 'notification',
scope: { scope: {
include: [{ include: {
relation: 'subscription', relation: 'subscription',
scope: { scope: {
include: { 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()) { for (const notificationUser of queue.notification().subscription()) {
try { try {
const sendParams = { const sendParams = {
recipient: 'pablone.verdnatura@gmail.com', recipient: notificationUser.user().emailUser().email,
lang: notificationUser.user().lang lang: notificationUser.user().lang
}; };

View File

@ -103,9 +103,6 @@
"NotificationSubscription": { "NotificationSubscription": {
"dataSource": "vn" "dataSource": "vn"
}, },
"NotificationTemplate": {
"dataSource": "vn"
},
"Province": { "Province": {
"dataSource": "vn" "dataSource": "vn"
}, },

View File

@ -25,11 +25,6 @@
"type": "hasMany", "type": "hasMany",
"model": "NotificationSubscription", "model": "NotificationSubscription",
"foreignKey": "notificationFk" "foreignKey": "notificationFk"
},
"notificationTemplate": {
"type": "belongsTo",
"model": "NotificationTemplate",
"foreignKey": "templateFk"
} }
} }
} }

View File

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

View File

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

View File

@ -18,7 +18,6 @@ class Email extends Component {
} }
async getSubject() { async getSubject() {
if (this.args.subject) return this.args.subject;
return (await this.getUserLocale())['subject']; return (await this.getUserLocale())['subject'];
} }

View File

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

View File

@ -0,0 +1,3 @@
subject: Asunto
title: Titulo
text: Texto