From f1fda284cb4eed1ae7632463f8f85e59c6f83997 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Tue, 11 Jul 2017 09:36:11 +0200 Subject: [PATCH] varios cambios --- services/mailer/application/Config/app.json | 9 ++++ services/mailer/application/Config/mysql.json | 7 +++ services/mailer/application/Config/smtp.json | 12 +++++ services/mailer/application/settings.js | 4 -- services/mailer/settings.js | 45 +++++++++++++++++++ .../common/methods/ticket/change-time.js | 2 +- .../common/models/fake-production.json | 4 +- .../production/common/models/warehouse.json | 4 +- 8 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 services/mailer/application/Config/app.json create mode 100644 services/mailer/application/Config/mysql.json create mode 100644 services/mailer/application/Config/smtp.json create mode 100644 services/mailer/settings.js diff --git a/services/mailer/application/Config/app.json b/services/mailer/application/Config/app.json new file mode 100644 index 000000000..72df39173 --- /dev/null +++ b/services/mailer/application/Config/app.json @@ -0,0 +1,9 @@ +{ + "name": "MailServer", + "version": "1.0.0", + "port": 3003, + "debug": true, + "defaultLanguage": "es", + "senderMail": "noreply@localhost", + "senderName": "" +} \ No newline at end of file diff --git a/services/mailer/application/Config/mysql.json b/services/mailer/application/Config/mysql.json new file mode 100644 index 000000000..ddfd88bed --- /dev/null +++ b/services/mailer/application/Config/mysql.json @@ -0,0 +1,7 @@ +{ + "host": "localhost", + "port": 3306, + "user": "reports", + "password": "", + "database": "" +} \ No newline at end of file diff --git a/services/mailer/application/Config/smtp.json b/services/mailer/application/Config/smtp.json new file mode 100644 index 000000000..e4953c14d --- /dev/null +++ b/services/mailer/application/Config/smtp.json @@ -0,0 +1,12 @@ +{ + "host": "localhost", + "port": 465, + "secure": true, + "auth": { + "user": "noreply", + "pass": "" + }, + "tls": { + "rejectUnauthorized": false + } +} \ No newline at end of file diff --git a/services/mailer/application/settings.js b/services/mailer/application/settings.js index 8c651ab29..afc89e730 100644 --- a/services/mailer/application/settings.js +++ b/services/mailer/application/settings.js @@ -1,5 +1,4 @@ var path = require('path'); - /** * Módulo de configuración */ @@ -18,7 +17,6 @@ module.exports = { return require(path.join(__dirname, 'config', `${name}.${env}.json`)); }, - /** * Configuración de la aplicación * @return {Object} Objeto de configuración app @@ -26,7 +24,6 @@ module.exports = { app: function() { return this.getConfig('app'); }, - /** * Configuración de smtp * @return {Object} Objeto de configuración smtp @@ -34,7 +31,6 @@ module.exports = { smtp: function() { return this.getConfig('smtp'); }, - /** * Configuración de mysql * @return {Object} Objeto de configuración MySQL diff --git a/services/mailer/settings.js b/services/mailer/settings.js new file mode 100644 index 000000000..8c651ab29 --- /dev/null +++ b/services/mailer/settings.js @@ -0,0 +1,45 @@ +var path = require('path'); + +/** + * Módulo de configuración + */ +module.exports = { + /** + * Obtiene la configuración en función del entorno en el que se está + * ejecutando la aplicación. + * @param {String} name Nombre del fichero + * @return {Object} Objeto de configuración + */ + getConfig: function(name) { + let env = process.env.NODE_ENV; + + if (!env) + env = 'development'; + + return require(path.join(__dirname, 'config', `${name}.${env}.json`)); + }, + + /** + * Configuración de la aplicación + * @return {Object} Objeto de configuración app + */ + app: function() { + return this.getConfig('app'); + }, + + /** + * Configuración de smtp + * @return {Object} Objeto de configuración smtp + */ + smtp: function() { + return this.getConfig('smtp'); + }, + + /** + * Configuración de mysql + * @return {Object} Objeto de configuración MySQL + */ + mysql: function() { + return this.getConfig('mysql'); + } +}; diff --git a/services/production/common/methods/ticket/change-time.js b/services/production/common/methods/ticket/change-time.js index e877c0051..d492c2800 100644 --- a/services/production/common/methods/ticket/change-time.js +++ b/services/production/common/methods/ticket/change-time.js @@ -21,7 +21,7 @@ module.exports = function(Ticket) { Ticket.changeTime = function(ctx, time, cb) { var tickets = ctx.req.body.tickets; var FakeProduction = Ticket.app.models.FakeProduction; - var hour = `${time}:00`; + var hour = `${time}`; var query = `update Ticket set date = CONCAT(DATE(date), ' ', ?) where id in (?)`; var params = [time, tickets]; diff --git a/services/production/common/models/fake-production.json b/services/production/common/models/fake-production.json index cc24898b0..77930c1d0 100644 --- a/services/production/common/models/fake-production.json +++ b/services/production/common/models/fake-production.json @@ -74,10 +74,10 @@ }, "acls": [ { - "accessType": "*", + "accessType": "READ", "principalType": "ROLE", "principalId": "$everyone", - "permission": "DENY" + "permission": "ALLOW" }, { "accessType": "*", diff --git a/services/production/common/models/warehouse.json b/services/production/common/models/warehouse.json index 28b814d60..8a6d85636 100644 --- a/services/production/common/models/warehouse.json +++ b/services/production/common/models/warehouse.json @@ -20,10 +20,10 @@ }, "acls": [ { - "accessType": "*", + "accessType": "READ", "principalType": "ROLE", "principalId": "$everyone", - "permission": "DENY" + "permission": "ALLOW" }, { "accessType": "*",