fix: refs #6276 resolve conflicts
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-02-02 08:11:00 +01:00
commit 9f9d953b86
5 changed files with 83 additions and 65 deletions

76
Jenkinsfile vendored
View File

@ -4,30 +4,8 @@ def PROTECTED_BRANCH
def FROM_GIT
def RUN_TESTS
pipeline {
agent any
options {
disableConcurrentBuilds()
}
environment {
PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
tools {
nodejs 'node-v20'
}
stages {
stage('Checkout') {
steps {
script {
// Uncomment to enable debugging
//env.DEBUG = 'strong-remoting:http-context,strong-remoting:shared-method'
pre: {
switch (env.BRANCH_NAME) {
case 'dev':
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
break
case 'test':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 2
@ -36,8 +14,26 @@ pipeline {
env.NODE_ENV = 'production'
env.BACK_REPLICAS = 4
break
default:
env.NODE_ENV = 'dev'
env.BACK_REPLICAS = 1
}
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
// Uncomment to enable debugging
// https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference
//env.DEBUG = 'strong-remoting:shared-method'
}
node {
stage('Setup') {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
@ -46,18 +42,22 @@ pipeline {
returnStdout: true
).trim()
PROTECTED_BRANCH = [
'dev',
'test',
'master'
].contains(env.BRANCH_NAME)
FROM_GIT = JOB_NAME.startsWith('gitea/')
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
}
setEnv()
}
}
pipeline {
agent any
options {
disableConcurrentBuilds()
}
tools {
nodejs 'node-v20'
}
environment {
PROJECT_NAME = 'salix'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
stages {
stage('Install') {
environment {
NODE_ENV = ""
@ -70,7 +70,7 @@ pipeline {
}
stage('Frontend') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=front'
@ -78,7 +78,7 @@ pipeline {
}
stage('Print') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
steps {
sh 'npm install --no-audit --prefer-offline --prefix=print'
@ -88,7 +88,7 @@ pipeline {
}
stage('Test') {
when {
expression { return RUN_TESTS }
expression { RUN_TESTS }
}
environment {
NODE_ENV = ""
@ -109,7 +109,7 @@ pipeline {
}
stage('Build') {
when {
expression { return PROTECTED_BRANCH && FROM_GIT }
expression { PROTECTED_BRANCH && FROM_GIT }
}
environment {
CREDENTIALS = credentials('docker-registry')
@ -121,7 +121,7 @@ pipeline {
}
stage('Deploy') {
when {
expression { return PROTECTED_BRANCH }
expression { PROTECTED_BRANCH }
}
parallel {
stage('Database') {
@ -139,7 +139,7 @@ pipeline {
}
stage('Docker') {
when {
expression { return FROM_GIT }
expression { FROM_GIT }
}
environment {
DOCKER_HOST = "${env.SWARM_HOST}"

View File

@ -21,11 +21,8 @@ BEGIN
DECLARE vAgencyModeFk INT;
DECLARE vNewPrice DECIMAL(10,2);
DECLARE vOldPrice DECIMAL(10,2);
DECLARE vOption INT DEFAULT NULL;
DECLARE vOption VARCHAR(255);
DECLARE vNewSaleFk INT;
DECLARE vChangePrice INT DEFAULT 1;
DECLARE vBuyerDiscount INT DEFAULT 4;
DECLARE vManaDiscount INT DEFAULT 3;
DECLARE vForceToGrouping INT DEFAULT 1;
DECLARE vForceToPacking INT DEFAULT 2;
DECLARE vFinalPrice DECIMAL(10,2);
@ -85,16 +82,13 @@ BEGIN
IF vNewPrice IS NULL THEN
CALL util.throw('price retrieval failed');
END IF;
IF vNewPrice > vOldPrice THEN
SET vFinalPrice = vOldPrice;
IF worker_isInDepartment('vt') THEN
SET vOption = vManaDiscount;
ELSE
SET vOption = vBuyerDiscount;
END IF;
SET vOption = 'substitution';
ELSE
SET vFinalPrice = vNewPrice;
SET vOption = vChangePrice;
SET vOption = 'renewPrices';
END IF;
START TRANSACTION;

View File

@ -337,8 +337,6 @@
"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",
"No hay tickets para sacar": "No hay tickets para sacar",
"There is no zone for these parameters 999999": "There is no zone for these parameters 999999",
"This machine is already in use.": "Esta máquina ya está en uso.",
"the plate does not exist": "La máquina {{plate}} no existe",
"We do not have availability for the selected item": "No tenemos disponible el item seleccionado",
@ -350,5 +348,5 @@
"printerNotExists": "No existe la impresora",
"There are not picking tickets": "No hay tickets para sacar",
"ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)",
"Este trabajador no existe": "Este trabajador no existe"
"An email is necessary": "Es necesario un email"
}

View File

@ -1,3 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = function(Self) {
Self.remoteMethod('createWithUser', {
description: 'Creates both client and its web account',
@ -29,7 +31,11 @@ module.exports = function(Self) {
myOptions.transaction = tx;
}
const firstEmail = data.email ? data.email.split(',')[0] : null;
if (!data.email)
throw new UserError('An email is necessary');
const firstEmail = data.email.split(',')[0];
const user = {
name: data.userName,
email: firstEmail,

View File

@ -13,6 +13,8 @@ describe('Client Create', () => {
businessTypeFk: 'florist',
provinceFk: 1
};
const newAccountWithoutEmail = JSON.parse(JSON.stringify(newAccount));
delete newAccountWithoutEmail.email;
beforeAll(async() => {
const activeCtx = {
@ -48,6 +50,24 @@ describe('Client Create', () => {
}
});
it('should not create a new account', async() => {
const tx = await models.Client.beginTransaction({});
let error;
try {
const options = {transaction: tx};
await models.Client.createWithUser(newAccountWithoutEmail, options);
await tx.rollback();
} catch (e) {
error = e.message;
await tx.rollback();
}
expect(error).toEqual(`An email is necessary`);
});
it('should create a new account', async() => {
const tx = await models.Client.beginTransaction({});