feat: refs #6367 new componenet
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2024-01-18 08:51:24 +01:00
parent 0d85e89dc1
commit ccb037da06
8 changed files with 27 additions and 54 deletions

View File

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

View File

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

View File

@ -25,11 +25,6 @@
"type": "hasMany",
"model": "NotificationSubscription",
"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() {
if (this.args.subject) return this.args.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