WIP: 6367-blankNotification #1903

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

View File

@ -49,7 +49,6 @@ module.exports = Self => {
}, myOptions);
const statusSent = 'sent';
const statusError = 'error';
for (const queue of notificationQueue) {
const queueName = queue.notification().name;
@ -58,7 +57,7 @@ module.exports = Self => {
for (const notificationUser of queue.notification().subscription()) {
try {
const sendParams = {
recipient: notificationUser.user().emailUser().email,
recipient: 'pablone.verdnatura@gmail.com',
lang: notificationUser.user().lang
};
@ -75,7 +74,8 @@ module.exports = Self => {
await queue.updateAttribute('status', statusSent);
} catch (error) {
await queue.updateAttribute('status', statusError);
console.log('error: ', error);
await queue.updateAttribute('status', 'error');
}
}
}

View File

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

View File

@ -0,0 +1,24 @@
{
"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

@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS `util`.`notificationTemplate` (

Se propone un enfoque en el cual no haya ninguna tabla nueva sino que se añada en la tabla notificaciones aunque sea una muy simple

Se propone un enfoque en el cual no haya ninguna tabla nueva sino que se añada en la tabla notificaciones aunque sea una muy simple
`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

@ -95,6 +95,8 @@ class Component {
build() {
const fullPath = path.resolve(__dirname, this.path);
console.log('this.path: ', this.path);
console.log('fullPath: ', fullPath);
if (!fs.existsSync(fullPath))
throw new Error(`Template "${this.name}" not found`);

View File

@ -0,0 +1,11 @@
const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([
`${vnPrintPath}/common/css/spacing.css`,
`${vnPrintPath}/common/css/misc.css`,
`${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/email.css`])
.mergeStyles();

View File

@ -0,0 +1,7 @@
<email-body v-bind="$props">
<div class="grid-row">
<div class="grid-block vn-pa-ml">
<h1>pinga</h1>
</div>
</div>
</email-body>

View File

@ -0,0 +1,19 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component();
console.log('entra');
module.exports = {
name: 'blank-notification',
components: {
'email-body': emailBody.build(),
},
props: {
title: {
type: String,
required: true
},
text: {
type: String,
required: true
}
}
};