From 616a28500ae0da61c88e1ee63af75e328953709a Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 25 Jul 2023 09:40:22 +0200 Subject: [PATCH 01/12] refs #5834 icon added --- front/salix/components/bank-entity/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/front/salix/components/bank-entity/index.html b/front/salix/components/bank-entity/index.html index 211b77317..65f95fcc0 100644 --- a/front/salix/components/bank-entity/index.html +++ b/front/salix/components/bank-entity/index.html @@ -32,6 +32,11 @@ value-field="id" label="Country"> + + Date: Fri, 3 Nov 2023 09:15:41 +0100 Subject: [PATCH 02/12] check bank entity refs 5834 --- back/models/bank-entity.js | 16 ++++++++++++++++ front/salix/components/bank-entity/index.html | 3 ++- front/salix/components/bank-entity/index.js | 2 +- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 4 +++- modules/client/front/billing-data/index.js | 3 --- modules/worker/front/create/index.js | 5 +++-- 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/back/models/bank-entity.js b/back/models/bank-entity.js index c89e0b364..16a6e9924 100644 --- a/back/models/bank-entity.js +++ b/back/models/bank-entity.js @@ -10,4 +10,20 @@ module.exports = Self => { Self.validatesUniquenessOf('bic', { message: 'This BIC already exist.' }); + + Self.validateAsync('bic', checkBic, { + message: 'Bank entity id must be specified' + }); + async function checkBic(err, done) { + const filter = { + fields: ['code'], + where: {id: this.countryFk} + }; + const country = await Self.app.models.Country.findOne(filter); + const code = country ? country.code.toLowerCase() : null; + + if (code == 'es' && !this.id) + err(); + done(); + } }; diff --git a/front/salix/components/bank-entity/index.html b/front/salix/components/bank-entity/index.html index 65f95fcc0..209994ae7 100644 --- a/front/salix/components/bank-entity/index.html +++ b/front/salix/components/bank-entity/index.html @@ -41,7 +41,8 @@ vn-one ng-show="country.selection.code === 'ES'" label="Entity code" - ng-model="$ctrl.data.id"> + ng-model="$ctrl.data.id" + required="true"> diff --git a/front/salix/components/bank-entity/index.js b/front/salix/components/bank-entity/index.js index 261018017..43653f148 100644 --- a/front/salix/components/bank-entity/index.js +++ b/front/salix/components/bank-entity/index.js @@ -10,7 +10,7 @@ class Controller extends Dialog { if (!this.data.countryFk) throw new Error(`The country can't be empty`); - return this.$http.post(`bankEntities`, this.data) + return this.$http.post(`BankEntities`, this.data) .then(res => this.data.id = res.data.id) .then(() => super.responseHandler(response)) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 26650175d..593353ae2 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -196,6 +196,7 @@ "Negative basis of tickets: 23": "Negative basis of tickets: 23", "Booking completed": "Booking complete", "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", - "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets" + "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", + "Bank entity must be specified": "Bank entity must be specified" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 3cc9a9627..1b43c31a6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -325,5 +325,7 @@ "Booking completed": "Reserva completada", "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mímina", - "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mímina" + "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mímina", + "Bank entity must be specified": "La entidad bancaria es obligatoria" } + diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js index 7056fa566..fe46eabae 100644 --- a/modules/client/front/billing-data/index.js +++ b/modules/client/front/billing-data/index.js @@ -51,15 +51,12 @@ export default class Controller extends Section { autofillBic() { if (!this.client || !this.client.iban) return; - let bankEntityId = parseInt(this.client.iban.substr(4, 4)); let filter = {where: {id: bankEntityId}}; if (this.ibanCountry != 'ES') return; - this.$http.get(`BankEntities`, {filter}).then(response => { const hasData = response.data && response.data[0]; - if (hasData) this.client.bankEntityFk = response.data[0].id; else if (!hasData) diff --git a/modules/worker/front/create/index.js b/modules/worker/front/create/index.js index e6d65221f..9a993ae60 100644 --- a/modules/worker/front/create/index.js +++ b/modules/worker/front/create/index.js @@ -30,7 +30,8 @@ export default class Controller extends Section { } autofillBic() { - if (!this.worker || !this.worker.iban) return; + AutoFillBicComponent.controller.prototype.autofillBic(this.client); + /* if (!this.worker || !this.worker.iban) return; let bankEntityId = parseInt(this.worker.iban.substr(4, 4)); let filter = {where: {id: bankEntityId}}; @@ -42,7 +43,7 @@ export default class Controller extends Section { this.worker.bankEntityFk = response.data[0].id; else if (!hasData) this.worker.bankEntityFk = null; - }); + }); */ } generateCodeUser() { From 0536486b8c9d2a145fda867383efa55ea5891d30 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 3 Nov 2023 09:16:59 +0100 Subject: [PATCH 03/12] ref #5834 fix locale --- loopback/locale/es.json | 1 - 1 file changed, 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1b43c31a6..4b1d991ec 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -321,7 +321,6 @@ "Select a different client": "Seleccione un cliente distinto", "Fill all the fields": "Rellene todos los campos", "The response is not a PDF": "La respuesta no es un PDF", - "Ticket without Route": "Ticket sin ruta", "Booking completed": "Reserva completada", "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mímina", From fe4c529bfe8490d0f27756bc6064b4317b4d0cdf Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 12 Jan 2024 13:05:00 +0100 Subject: [PATCH 04/12] refs #5834 perf: remove front code --- front/salix/components/bank-entity/index.html | 8 +------- front/salix/components/bank-entity/index.js | 2 +- modules/client/front/billing-data/index.js | 3 +++ modules/worker/front/create/index.js | 5 ++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/front/salix/components/bank-entity/index.html b/front/salix/components/bank-entity/index.html index 209994ae7..211b77317 100644 --- a/front/salix/components/bank-entity/index.html +++ b/front/salix/components/bank-entity/index.html @@ -32,17 +32,11 @@ value-field="id" label="Country"> - - + ng-model="$ctrl.data.id"> diff --git a/front/salix/components/bank-entity/index.js b/front/salix/components/bank-entity/index.js index 43653f148..261018017 100644 --- a/front/salix/components/bank-entity/index.js +++ b/front/salix/components/bank-entity/index.js @@ -10,7 +10,7 @@ class Controller extends Dialog { if (!this.data.countryFk) throw new Error(`The country can't be empty`); - return this.$http.post(`BankEntities`, this.data) + return this.$http.post(`bankEntities`, this.data) .then(res => this.data.id = res.data.id) .then(() => super.responseHandler(response)) .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); diff --git a/modules/client/front/billing-data/index.js b/modules/client/front/billing-data/index.js index fe46eabae..7056fa566 100644 --- a/modules/client/front/billing-data/index.js +++ b/modules/client/front/billing-data/index.js @@ -51,12 +51,15 @@ export default class Controller extends Section { autofillBic() { if (!this.client || !this.client.iban) return; + let bankEntityId = parseInt(this.client.iban.substr(4, 4)); let filter = {where: {id: bankEntityId}}; if (this.ibanCountry != 'ES') return; + this.$http.get(`BankEntities`, {filter}).then(response => { const hasData = response.data && response.data[0]; + if (hasData) this.client.bankEntityFk = response.data[0].id; else if (!hasData) diff --git a/modules/worker/front/create/index.js b/modules/worker/front/create/index.js index 9a993ae60..e6d65221f 100644 --- a/modules/worker/front/create/index.js +++ b/modules/worker/front/create/index.js @@ -30,8 +30,7 @@ export default class Controller extends Section { } autofillBic() { - AutoFillBicComponent.controller.prototype.autofillBic(this.client); - /* if (!this.worker || !this.worker.iban) return; + if (!this.worker || !this.worker.iban) return; let bankEntityId = parseInt(this.worker.iban.substr(4, 4)); let filter = {where: {id: bankEntityId}}; @@ -43,7 +42,7 @@ export default class Controller extends Section { this.worker.bankEntityFk = response.data[0].id; else if (!hasData) this.worker.bankEntityFk = null; - }); */ + }); } generateCodeUser() { From ed0f942a5780ee083036642290d2e2bb0b1bed67 Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 30 Jan 2024 09:45:37 +0100 Subject: [PATCH 05/12] refs #6444 create vn.intrastat_estimateNet.sql --- .../vn/functions/intrastat_estimateNet.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 db/routines/vn/functions/intrastat_estimateNet.sql diff --git a/db/routines/vn/functions/intrastat_estimateNet.sql b/db/routines/vn/functions/intrastat_estimateNet.sql new file mode 100644 index 000000000..4d66e30de --- /dev/null +++ b/db/routines/vn/functions/intrastat_estimateNet.sql @@ -0,0 +1,19 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(intINSTRASTAT INTEGER,intUNIDADES INTEGER) + RETURNS double + DETERMINISTIC +BEGIN + + DECLARE n DOUBLE; + + SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM + (SELECT *, unidades / neto MEDIA + FROM vn2008.intrastat_data + WHERE intrastat_id = intINSTRASTAT AND neto + AND unidades > 0 + ORDER BY odbc_date DESC + LIMIT 20) t; + RETURN n/2; + +END$$ +DELIMITER ; \ No newline at end of file From da2a2b5f09cb85d4f01da06265db356fe96780dd Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 30 Jan 2024 13:33:54 +0100 Subject: [PATCH 06/12] refs #6444 Remove vn2008.intrastat_neto function --- .../vn2008/functions/intrastat_neto.sql | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 db/routines/vn2008/functions/intrastat_neto.sql diff --git a/db/routines/vn2008/functions/intrastat_neto.sql b/db/routines/vn2008/functions/intrastat_neto.sql deleted file mode 100644 index 34e01de8c..000000000 --- a/db/routines/vn2008/functions/intrastat_neto.sql +++ /dev/null @@ -1,20 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn2008`.`intrastat_neto`(intINSTRASTAT INTEGER,intUNIDADES INTEGER) - RETURNS double - DETERMINISTIC -BEGIN - - DECLARE n DOUBLE; - - SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM - (SELECT *, unidades / neto MEDIA - FROM intrastat_data - WHERE intrastat_id = intINSTRASTAT AND neto - AND unidades > 0 - ORDER BY odbc_date DESC - LIMIT 20) t; - -- JGF 01/06 per a evitar Kg en negatiu - RETURN n/2; - -END$$ -DELIMITER ; From b4bb9a48495652429270f38cc121c0a802112dbb Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 31 Jan 2024 10:46:16 +0100 Subject: [PATCH 07/12] refs #5834 feat: new validation --- back/models/bank-entity.js | 6 +++++- loopback/locale/es.json | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/back/models/bank-entity.js b/back/models/bank-entity.js index 16a6e9924..ac352f93c 100644 --- a/back/models/bank-entity.js +++ b/back/models/bank-entity.js @@ -8,7 +8,11 @@ module.exports = Self => { }); Self.validatesUniquenessOf('bic', { - message: 'This BIC already exist.' + message: 'This BIC already exist' + }); + + Self.validatesPresenceOf('countryFk', { + message: 'CountryFK cannot be empty' }); Self.validateAsync('bic', checkBic, { diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 4a452a6d7..3d25d6ab5 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -72,7 +72,7 @@ "The secret can't be blank": "La contraseña no puede estar en blanco", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", @@ -180,7 +180,8 @@ "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", - "This BIC already exist.": "Este BIC ya existe.", + "CountryFK cannot be empty": "El país no puede estar vacío", + "This BIC already exist": "Este BIC ya existe", "That item doesn't exists": "Ese artículo no existe", "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", "Invalid account": "Cuenta inválida", @@ -337,6 +338,5 @@ "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", - "Bank entity must be specified": "La entidad bancaria es obligatoria" + "Bank entity must be specified": "La entidad bancaria es obligatoria" } - From 7b1a0e1957fa91ae004525fd00caaaa8a0ca0a49 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 1 Feb 2024 13:02:03 +0100 Subject: [PATCH 08/12] refs #6444 change code according to sql conventions --- .../vn/functions/intrastat_estimateNet.sql | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/db/routines/vn/functions/intrastat_estimateNet.sql b/db/routines/vn/functions/intrastat_estimateNet.sql index 4d66e30de..99a52ded8 100644 --- a/db/routines/vn/functions/intrastat_estimateNet.sql +++ b/db/routines/vn/functions/intrastat_estimateNet.sql @@ -1,19 +1,21 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(intINSTRASTAT INTEGER,intUNIDADES INTEGER) +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(vIntrastat INT, vUnidades INT) RETURNS double DETERMINISTIC BEGIN - DECLARE n DOUBLE; + DECLARE vNet DOUBLE; - SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM - (SELECT *, unidades / neto MEDIA - FROM vn2008.intrastat_data - WHERE intrastat_id = intINSTRASTAT AND neto - AND unidades > 0 - ORDER BY odbc_date DESC - LIMIT 20) t; - RETURN n/2; + SELECT ROUND(vUnidades / (SUM(media) / COUNT(media)), 2) INTO vNet + FROM (SELECT *, unidades / neto media + FROM vn2008.intrastat_data + WHERE intrastat_id = vIntrastat + AND neto + AND unidades > 0 + ORDER BY odbc_date DESC + LIMIT 20) t; + + RETURN vNet/2; END$$ DELIMITER ; \ No newline at end of file From 1a869766b9ed7cf8a46ba35cd331111e56e645fc Mon Sep 17 00:00:00 2001 From: ivanm Date: Mon, 5 Feb 2024 08:32:45 +0100 Subject: [PATCH 09/12] refs #6444 change code accord to conventions --- .../vn/functions/intrastat_estimateNet.sql | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/db/routines/vn/functions/intrastat_estimateNet.sql b/db/routines/vn/functions/intrastat_estimateNet.sql index 99a52ded8..3ee1ca80f 100644 --- a/db/routines/vn/functions/intrastat_estimateNet.sql +++ b/db/routines/vn/functions/intrastat_estimateNet.sql @@ -1,21 +1,32 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`(vIntrastat INT, vUnidades INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`( + vSelf INT, + vUnits INT +) RETURNS double DETERMINISTIC BEGIN - +/** +* Calcula un valor neto estimado en función de +* datos históricos de facturas intrastat. +* +* @param vSelf Id de intrastat +* @param vUnits Número de unidades +* @return vNet +*/ DECLARE vNet DOUBLE; - SELECT ROUND(vUnidades / (SUM(media) / COUNT(media)), 2) INTO vNet - FROM (SELECT *, unidades / neto media - FROM vn2008.intrastat_data - WHERE intrastat_id = vIntrastat - AND neto - AND unidades > 0 - ORDER BY odbc_date DESC - LIMIT 20) t; + SELECT ROUND(vUnits / (SUM(average) / COUNT(average)), 2) INTO vNet + FROM ( + SELECT *, stems / net average + FROM invoiceInIntrastat + WHERE intrastatFk = vSelf + AND net + AND stems > 0 + ORDER BY dated DESC + LIMIT 20 + ) sub; RETURN vNet/2; - END$$ DELIMITER ; \ No newline at end of file From 438af34d73a5b85c3b0ffe8cb2f989275fc0f936 Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 6 Feb 2024 08:40:06 +0100 Subject: [PATCH 10/12] refs #6444 cambio vUnits por vStems --- db/routines/vn/functions/intrastat_estimateNet.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/functions/intrastat_estimateNet.sql b/db/routines/vn/functions/intrastat_estimateNet.sql index 3ee1ca80f..350cb788a 100644 --- a/db/routines/vn/functions/intrastat_estimateNet.sql +++ b/db/routines/vn/functions/intrastat_estimateNet.sql @@ -1,7 +1,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`intrastat_estimateNet`( vSelf INT, - vUnits INT + vStems INT ) RETURNS double DETERMINISTIC @@ -11,12 +11,12 @@ BEGIN * datos históricos de facturas intrastat. * * @param vSelf Id de intrastat -* @param vUnits Número de unidades +* @param vStems Número de unidades * @return vNet */ DECLARE vNet DOUBLE; - SELECT ROUND(vUnits / (SUM(average) / COUNT(average)), 2) INTO vNet + SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet FROM ( SELECT *, stems / net average FROM invoiceInIntrastat From a67a347a9ef185ed809468d958c215aa00d4b4ee Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 21:51:15 +0100 Subject: [PATCH 11/12] ci: refs#6706 CI fixes --- .dockerignore | 6 ++++-- Jenkinsfile | 23 ++++++++++++----------- back/tests.js | 41 ++++++++++++++++++++++++++++++----------- docker-compose.yml | 10 ++++++---- front/Dockerfile | 2 +- gulpfile.js | 2 +- package.json | 3 ++- pnpm-lock.yaml | 3 +++ webpack.config.js | 4 ++-- 9 files changed, 61 insertions(+), 33 deletions(-) diff --git a/.dockerignore b/.dockerignore index afe81bb0f..1a47908ab 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ node_modules print/node_modules -front/node_modules -services \ No newline at end of file +front +db +e2e +storage diff --git a/Jenkinsfile b/Jenkinsfile index 56e33f4ae..4bacaa6d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,9 +86,6 @@ pipeline { } } stage('Stack') { - environment { - TZ = 'Europe/Madrid' - } parallel { stage('Back') { stages { @@ -104,14 +101,10 @@ pipeline { } post { always { - script { - try { - junit 'junitresults.xml' - junit 'junit.xml' - } catch (e) { - echo e.toString() - } - } + junit( + testResults: 'junitresults.xml', + allowEmptyResults: true + ) } } } @@ -144,6 +137,14 @@ pipeline { steps { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=10' } + post { + always { + junit( + testResults: 'junit.xml', + allowEmptyResults: true + ) + } + } } stage('Build') { when { diff --git a/back/tests.js b/back/tests.js index 0fb4c76ea..1848132f8 100644 --- a/back/tests.js +++ b/back/tests.js @@ -1,19 +1,36 @@ /* eslint-disable no-console */ const path = require('path'); +const getopts = require('getopts'); const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); const helper = require('./tests-helper'); +const opts = getopts(process.argv.slice(2), { + string: [ + 'network' + ], + boolean: [ + 'ci', + 'junit' + ] +}); + let server; -const isCI = process.argv[2] === 'ci'; const PARALLEL = false; const TIMEOUT = 900000; -process.on('SIGINT', teardown); process.on('exit', teardown); process.on('uncaughtException', onError); process.on('unhandledRejection', onError); +const exitSignals = [ + 'SIGINT', + 'SIGUSR1', + 'SIGUSR2' +]; +for (const signal of exitSignals) + process.on(signal, () => process.exit()); + async function setup() { console.log('Building and running DB container.'); @@ -21,9 +38,9 @@ async function setup() { await myt.init({ workspace: path.join(__dirname, '..'), random: true, - ci: isCI, + ci: opts.ci, tmpfs: process.platform == 'linux', - network: isCI ? 'jenkins' : null + network: opts.network || null }); server = await myt.run(Run); await myt.deinit(); @@ -38,18 +55,19 @@ async function setup() { async function teardown() { if (!server) return; + const oldServer = server; + server = null; if (!PARALLEL) await helper.deinit(); console.log('Stopping and removing DB container.'); - await server.rm(); - server = null; + await oldServer.rm(); } async function onError(err) { - await teardown(); console.error(err); + process.exit(1); } async function test() { @@ -79,8 +97,8 @@ async function test() { const SpecReporter = require('jasmine-spec-reporter').SpecReporter; runner.addReporter(new SpecReporter({ spec: { - displaySuccessful: isCI, - displayPending: isCI + displaySuccessful: opts.ci, + displayPending: opts.ci }, summary: { displayPending: false, @@ -88,11 +106,12 @@ async function test() { })); } - if (isCI) { + if (opts.junit) { const JunitReporter = require('jasmine-reporters'); runner.addReporter(new JunitReporter.JUnitXmlReporter()); - runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT; } + if (opts.ci) + runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = TIMEOUT; // runner.loadConfigFile('back/jasmine.json'); runner.loadConfig(config); diff --git a/docker-compose.yml b/docker-compose.yml index dda4187f2..8391a5e23 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,9 @@ services: front: image: registry.verdnatura.es/salix-front:${VERSION:?} build: - context: . - dockerfile: front/Dockerfile + context: front + environment: + - TZ ports: - 80 deploy: @@ -18,11 +19,12 @@ services: back: image: registry.verdnatura.es/salix-back:${VERSION:?} build: . - ports: - - 3000 environment: - NODE_ENV - DEBUG + - TZ + ports: + - 3000 configs: - source: datasources target: /etc/salix/datasources.json diff --git a/front/Dockerfile b/front/Dockerfile index d0ee26904..c507d863c 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update \ && ln -sf /dev/stderr /var/log/nginx/error.log WORKDIR /etc/nginx -COPY front/nginx.conf sites-available/salix +COPY nginx.conf sites-available/salix RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/salix COPY dist /salix/dist diff --git a/gulpfile.js b/gulpfile.js index a4caa6196..1c6fe2a2d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,7 +17,7 @@ if (argv.NODE_ENV) let langs = ['es', 'en']; let srcDir = './front'; let modulesDir = './modules'; -let buildDir = 'dist'; +let buildDir = 'front/dist'; let backSources = [ '!node_modules', diff --git a/package.json b/package.json index 04c0e6d04..ff8eca428 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "eslint-plugin-jasmine": "^2.10.1", "fancy-log": "^1.3.2", "file-loader": "^6.2.0", + "getopts": "^2.3.0", "gulp": "^4.0.2", "gulp-concat": "^2.6.1", "gulp-env": "^0.4.0", @@ -107,7 +108,7 @@ "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", - "test:back:ci": "node back/tests.js ci", + "test:back:ci": "node back/tests.js --ci --junit --network jenkins", "test:e2e": "node e2e/helpers/tests.js", "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2df0ae49c..69528e3e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -163,6 +163,9 @@ devDependencies: file-loader: specifier: ^6.2.0 version: 6.2.0(webpack@5.90.1) + getopts: + specifier: ^2.3.0 + version: 2.3.0 gulp: specifier: ^4.0.2 version: 4.0.2 diff --git a/webpack.config.js b/webpack.config.js index a102b838e..7296a62d1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,7 +11,7 @@ let baseConfig = { entry: {salix: 'salix'}, mode, output: { - path: path.join(__dirname, 'dist'), + path: path.join(__dirname, 'front/dist'), publicPath: '/' }, module: { @@ -139,7 +139,7 @@ let devConfig = { host: '0.0.0.0', port: 5000, publicPath: '/', - contentBase: 'dist', + contentBase: 'front/dist', quiet: false, noInfo: false, hot: true, From 46dee65e6886a5343d520fa6b314710c4440a113 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 6 Feb 2024 22:22:25 +0100 Subject: [PATCH 12/12] ci: refs#6706 Myt updated --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ff8eca428..73fa5fc7a 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.3", + "@verdnatura/myt": "^1.6.5", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69528e3e2..83904cf41 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,8 +128,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.3 - version: 1.6.3 + specifier: ^1.6.5 + version: 1.6.5 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2633,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.3: - resolution: {integrity: sha512-VRoTB5sEPL8a7VaX9l2afpaPNT6pBa+If1tP9tpaJ4enFQbNITlApcC0GK6XYmWMkJQjl2lgdN4/u0UCiNb2MQ==} + /@verdnatura/myt@1.6.5: + resolution: {integrity: sha512-0h7FvhSewd2W9EOymc59YymZJOBfCXmY5CWNFhol1yBfWSOOF9JAEE9DKRMbKaMqd/5Dy9LriS5PYOfeqm3HjA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5