7152-devToTest_2414 #2228
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [2352.01] - 2023-12-28
|
## [2402.01] - 2024-01-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
### Changed
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
## [2400.01] - 2024-01-04
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -13,9 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [2350.01] - 2023-12-14
|
## [2350.01] - 2023-12-14
|
||||||
|
|
||||||
### Added
|
### Características Añadidas 🆕
|
||||||
### Changed
|
- **Tickets → Expediciones:** Añadido soporte para Viaexpress
|
||||||
### Fixed
|
|
||||||
|
|
||||||
|
|
||||||
## [2348.01] - 2023-11-30
|
## [2348.01] - 2023-11-30
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
const handlePromiseLogout = (Self, {id}, courtesyTime) => {
|
||||||
|
new Promise(res => {
|
||||||
|
setTimeout(() => {
|
||||||
|
res(Self.logout(id));
|
||||||
|
}
|
||||||
|
, courtesyTime * 1000);
|
||||||
|
});
|
||||||
|
};
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('renewToken', {
|
Self.remoteMethodCtx('renewToken', {
|
||||||
description: 'Checks if the token has more than renewPeriod seconds to live and if so, renews it',
|
description: 'Checks if the token has more than renewPeriod seconds to live and if so, renews it',
|
||||||
|
@ -16,23 +25,32 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.renewToken = async function(ctx) {
|
Self.renewToken = async function(ctx) {
|
||||||
const models = Self.app.models;
|
const {accessToken: token} = ctx.req;
|
||||||
const token = ctx.req.accessToken;
|
|
||||||
|
|
||||||
const now = new Date();
|
// Check if current token is valid
|
||||||
const differenceMilliseconds = now - token.created;
|
const isValid = await validateToken(token);
|
||||||
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
if (isValid)
|
||||||
|
return token;
|
||||||
|
|
||||||
const fields = ['renewPeriod', 'courtesyTime'];
|
const {courtesyTime} = await models.AccessTokenConfig.findOne({fields: ['courtesyTime']});
|
||||||
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields});
|
|
||||||
|
|
||||||
if (differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime)
|
// Schedule to remove current token
|
||||||
throw new UserError(`The renew period has not been exceeded`, 'periodNotExceeded');
|
handlePromiseLogout(Self, token, courtesyTime);
|
||||||
|
|
||||||
await Self.logout(token.id);
|
// Create new accessToken
|
||||||
const user = await Self.findById(token.userId);
|
const user = await Self.findById(token.userId);
|
||||||
const accessToken = await user.createAccessToken();
|
const accessToken = await user.createAccessToken();
|
||||||
|
|
||||||
return {id: accessToken.id, ttl: accessToken.ttl};
|
return {id: accessToken.id, ttl: accessToken.ttl};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function validateToken(token) {
|
||||||
|
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod', 'courtesyTime']});
|
||||||
|
const now = Date.now();
|
||||||
|
const differenceMilliseconds = now - token.created;
|
||||||
|
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
||||||
|
const isValid = differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime;
|
||||||
|
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
describe('Renew Token', () => {
|
||||||
|
const startingTime = Date.now();
|
||||||
|
let ctx = null;
|
||||||
|
beforeAll(async() => {
|
||||||
|
const unAuthCtx = {
|
||||||
|
req: {
|
||||||
|
headers: {},
|
||||||
|
connection: {
|
||||||
|
remoteAddress: '127.0.0.1'
|
||||||
|
},
|
||||||
|
getLocale: () => 'en'
|
||||||
|
},
|
||||||
|
args: {}
|
||||||
|
};
|
||||||
|
let login = await models.VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
|
||||||
|
let accessToken = await models.AccessToken.findById(login.token);
|
||||||
|
ctx = {req: {accessToken: accessToken}};
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jasmine.clock().install();
|
||||||
|
jasmine.clock().mockDate(new Date(startingTime));
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.clock().uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should renew process', async() => {
|
||||||
|
jasmine.clock().mockDate(new Date(startingTime + 21600000));
|
||||||
|
const {id} = await models.VnUser.renewToken(ctx);
|
||||||
|
|
||||||
|
expect(id).not.toEqual(ctx.req.accessToken.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('NOT should renew', async() => {
|
||||||
|
let error;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
response = await models.VnUser.renewToken(ctx);
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeUndefined();
|
||||||
|
expect(response.id).toEqual(ctx.req.accessToken.id);
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,17 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethod('validateToken', {
|
|
||||||
description: 'Validates the current logged user token',
|
|
||||||
returns: {
|
|
||||||
type: 'Boolean',
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
path: `/validateToken`,
|
|
||||||
verb: 'GET'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.validateToken = async function() {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -10,7 +10,6 @@ module.exports = function(Self) {
|
||||||
require('../methods/vn-user/sign-in')(Self);
|
require('../methods/vn-user/sign-in')(Self);
|
||||||
require('../methods/vn-user/acl')(Self);
|
require('../methods/vn-user/acl')(Self);
|
||||||
require('../methods/vn-user/recover-password')(Self);
|
require('../methods/vn-user/recover-password')(Self);
|
||||||
require('../methods/vn-user/validate-token')(Self);
|
|
||||||
require('../methods/vn-user/privileges')(Self);
|
require('../methods/vn-user/privileges')(Self);
|
||||||
require('../methods/vn-user/validate-auth')(Self);
|
require('../methods/vn-user/validate-auth')(Self);
|
||||||
require('../methods/vn-user/renew-token')(Self);
|
require('../methods/vn-user/renew-token')(Self);
|
||||||
|
|
|
@ -102,13 +102,6 @@
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
},
|
|
||||||
{
|
|
||||||
"property": "validateToken",
|
|
||||||
"accessType": "EXECUTE",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"property": "validateAuth",
|
"property": "validateAuth",
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
-- Auto-generated SQL script #202311061003
|
||||||
|
UPDATE salix.accessTokenConfig
|
||||||
|
SET courtesyTime=60
|
||||||
|
WHERE id=1;
|
|
@ -1,4 +1,4 @@
|
||||||
RENAME TABLE `vn`.`clientCreditLimit` TO `vn`.`roleCreditLimit`;
|
RENAME TABLE `vn`.`clientCreditLimit` TO `vn`.`roleCreditLimit`;
|
||||||
ALTER TABLE `vn`.`clientCreditLimit` DROP FOREIGN KEY `clientCreditLimit_FK`;
|
ALTER TABLE `vn`.`roleCreditLimit` DROP FOREIGN KEY `clientCreditLimit_FK`;
|
||||||
ALTER TABLE `vn`.`roleCreditLimit` ADD CONSTRAINT `roleCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
ALTER TABLE `vn`.`roleCreditLimit` ADD CONSTRAINT `roleCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
||||||
|
USE `vn`;
|
||||||
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `vn`.`ticketState`
|
VIEW `ticketState`
|
||||||
AS SELECT `tt`.`created` AS `updated`,
|
AS SELECT `tt`.`created` AS `updated`,
|
||||||
`tt`.`stateFk` AS `stateFk`,
|
`tt`.`stateFk` AS `stateFk`,
|
||||||
`tt`.`userFk` AS `userFk`,
|
`tt`.`userFk` AS `workerFk`,
|
||||||
`tls`.`ticketFk` AS `ticketFk`,
|
`tls`.`ticketFk` AS `ticketFk`,
|
||||||
`s`.`id` AS `state`,
|
`s`.`id` AS `state`,
|
||||||
`s`.`order` AS `productionOrder`,
|
`s`.`order` AS `productionOrder`,
|
||||||
|
@ -15,10 +18,10 @@ AS SELECT `tt`.`created` AS `updated`,
|
||||||
`s`.`isPicked` AS `isPicked`
|
`s`.`isPicked` AS `isPicked`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
`vn`.`ticketLastState` `tls`
|
`ticketLastState` `tls`
|
||||||
JOIN `vn`.`ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
|
JOIN `ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
|
||||||
)
|
)
|
||||||
JOIN `vn`.`state` `s` ON(`s`.`id` = `tt`.`stateFk`)
|
JOIN `state` `s` ON(`s`.`id` = `tt`.`stateFk`)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
@ -33,14 +36,15 @@ AS SELECT `tt`.`id` AS `inter_id`,
|
||||||
`tt`.`supervisorFk` AS `Id_supervisor`
|
`tt`.`supervisorFk` AS `Id_supervisor`
|
||||||
FROM `vn`.`ticketTracking` `tt`;
|
FROM `vn`.`ticketTracking` `tt`;
|
||||||
|
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
ALGORITHM = UNDEFINED VIEW `ticketStateToday` AS
|
SQL SECURITY DEFINER
|
||||||
SELECT
|
VIEW `ticketStateToday`
|
||||||
|
AS SELECT
|
||||||
`ts`.`ticket` AS `ticket`,
|
`ts`.`ticket` AS `ticket`,
|
||||||
`ts`.`state` AS `state`,
|
`ts`.`state` AS `state`,
|
||||||
`ts`.`productionOrder` AS `productionOrder`,
|
`ts`.`productionOrder` AS `productionOrder`,
|
||||||
`ts`.`alertLevel` AS `alertLevel`,
|
`ts`.`alertLevel` AS `alertLevel`,
|
||||||
`ts`.`userFk` AS `userFk`,
|
`ts`.`worker` AS `worker`,
|
||||||
`ts`.`code` AS `code`,
|
`ts`.`code` AS `code`,
|
||||||
`ts`.`updated` AS `updated`,
|
`ts`.`updated` AS `updated`,
|
||||||
`ts`.`isPicked` AS `isPicked`
|
`ts`.`isPicked` AS `isPicked`
|
|
@ -2967,9 +2967,9 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
|
||||||
(2, 1, 50, 2),
|
(2, 1, 50, 2),
|
||||||
(3, 1, 0, 3);
|
(3, 1, 0, 3);
|
||||||
|
|
||||||
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
|
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 21600, 300);
|
(1, 21600, 60, 300);
|
||||||
|
|
||||||
INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
|
INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -26391,6 +26391,7 @@ CREATE TABLE `cplusCorrectingType` (
|
||||||
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `cplusRectificationType`
|
-- Table structure for table `cplusRectificationType`
|
||||||
--
|
--
|
||||||
|
|
|
@ -82,7 +82,7 @@ export default class Token {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
this.renewPeriod = data.renewPeriod;
|
this.renewPeriod = data.renewPeriod;
|
||||||
this.stopRenewer();
|
this.stopRenewer();
|
||||||
this.inservalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
|
this.intervalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,17 +103,13 @@ export default class Token {
|
||||||
const token = res.data;
|
const token = res.data;
|
||||||
this.set(token.id, now, token.ttl, this.remember);
|
this.set(token.id, now, token.ttl, this.remember);
|
||||||
})
|
})
|
||||||
.catch(res => {
|
|
||||||
if (res.data?.error?.code !== 'periodNotExceeded')
|
|
||||||
throw res;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.checking = false;
|
this.checking = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
stopRenewer() {
|
stopRenewer() {
|
||||||
clearInterval(this.inservalId);
|
clearInterval(this.intervalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
|
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
|
||||||
|
|
|
@ -18,7 +18,7 @@ Show summary: Mostrar vista previa
|
||||||
What is new: Novedades de la versión
|
What is new: Novedades de la versión
|
||||||
Settings: Ajustes
|
Settings: Ajustes
|
||||||
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
|
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
|
||||||
This ticket is locked.: Este ticket está bloqueado
|
This ticket is locked: Este ticket está bloqueado
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@
|
||||||
"Social name should be uppercase": "Social name should be uppercase",
|
"Social name should be uppercase": "Social name should be uppercase",
|
||||||
"Street should be uppercase": "Street should be uppercase",
|
"Street should be uppercase": "Street should be uppercase",
|
||||||
"You don't have enough privileges.": "You don't have enough privileges.",
|
"You don't have enough privileges.": "You don't have enough privileges.",
|
||||||
"This ticket is locked.": "This ticket is locked.",
|
"This ticket is locked": "This ticket is locked",
|
||||||
"This ticket is not editable.": "This ticket is not editable.",
|
"This ticket is not editable.": "This ticket is not editable.",
|
||||||
"The ticket doesn't exist.": "The ticket doesn't exist.",
|
"The ticket doesn't exist.": "The ticket doesn't exist.",
|
||||||
"The sales do not exists": "The sales do not exists",
|
"The sales do not exists": "The sales do not exists",
|
||||||
|
|
|
@ -312,7 +312,7 @@
|
||||||
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
|
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
|
||||||
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
|
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
|
||||||
"You don't have enough privileges.": "No tienes suficientes permisos.",
|
"You don't have enough privileges.": "No tienes suficientes permisos.",
|
||||||
"This ticket is locked.": "Este ticket está bloqueado.",
|
"This ticket is locked": "Este ticket está bloqueado.",
|
||||||
"This ticket is not editable.": "Este ticket no es editable.",
|
"This ticket is not editable.": "Este ticket no es editable.",
|
||||||
"The ticket doesn't exist.": "No existe el ticket.",
|
"The ticket doesn't exist.": "No existe el ticket.",
|
||||||
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
Date.vnUTC = () => {
|
Date.vnUTC = (env = process.env.NODE_ENV) => {
|
||||||
const env = process.env.NODE_ENV;
|
|
||||||
if (!env || env === 'development')
|
if (!env || env === 'development')
|
||||||
return new Date(Date.UTC(2001, 0, 1, 11));
|
return new Date(Date.UTC(2001, 0, 1, 11));
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('account changePassword()', () => {
|
describe('account changePassword()', () => {
|
||||||
const userId = 70;
|
const userId = 70;
|
||||||
const unauthCtx = {
|
const unAuthCtx = {
|
||||||
req: {
|
req: {
|
||||||
headers: {},
|
headers: {},
|
||||||
connection: {
|
connection: {
|
||||||
|
@ -79,7 +79,7 @@ describe('account changePassword()', () => {
|
||||||
passExpired: yesterday
|
passExpired: yesterday
|
||||||
}
|
}
|
||||||
, options);
|
, options);
|
||||||
await models.VnUser.signIn(unauthCtx, 'trainee', 'nightmare', options);
|
await models.VnUser.signIn(unAuthCtx, 'trainee', 'nightmare', options);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message != 'Pass expired')
|
if (e.message != 'Pass expired')
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -17,3 +17,18 @@ columns:
|
||||||
agencyModeFk: agency
|
agencyModeFk: agency
|
||||||
routeFk: route
|
routeFk: route
|
||||||
zoneFk: zone
|
zoneFk: zone
|
||||||
|
name: name
|
||||||
|
beachFk: beach
|
||||||
|
ticketPacked: tickets packed
|
||||||
|
ticketFree: tickets free
|
||||||
|
ticketProduction: tickets production
|
||||||
|
packages: packages
|
||||||
|
note: note
|
||||||
|
dated: dated
|
||||||
|
dockFk: dock
|
||||||
|
priority: priority
|
||||||
|
etd: etd
|
||||||
|
expeditionTruckFk: truck
|
||||||
|
m3boxes: m3 boxes
|
||||||
|
bufferFk: buffer
|
||||||
|
isPickingAllowed: is picking allowed
|
|
@ -17,3 +17,18 @@ columns:
|
||||||
agencyModeFk: agencia
|
agencyModeFk: agencia
|
||||||
routeFk: ruta
|
routeFk: ruta
|
||||||
zoneFk: zona
|
zoneFk: zona
|
||||||
|
name: nombre
|
||||||
|
beachFk: playa
|
||||||
|
ticketPacked: tickets encajados
|
||||||
|
ticketFree: tickets libres
|
||||||
|
ticketProduction: tickets producción
|
||||||
|
packages: paquetes
|
||||||
|
note: nota
|
||||||
|
dated: fecha
|
||||||
|
dockFk: muelle
|
||||||
|
priority: prioridad
|
||||||
|
etd: etd
|
||||||
|
expeditionTruckFk: camión
|
||||||
|
m3boxes: m3 cajas
|
||||||
|
bufferFk: buffer
|
||||||
|
isPickingAllowed: está permitido recoger
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
||||||
throw new ForbiddenError(`This ticket is not editable.`);
|
throw new ForbiddenError(`This ticket is not editable.`);
|
||||||
|
|
||||||
if (isLocked && !isWeekly)
|
if (isLocked && !isWeekly)
|
||||||
throw new ForbiddenError(`This ticket is locked.`);
|
throw new ForbiddenError(`This ticket is locked`);
|
||||||
|
|
||||||
if (isWeekly && !canEditWeeklyTicket)
|
if (isWeekly && !canEditWeeklyTicket)
|
||||||
throw new ForbiddenError(`You don't have enough privileges.`);
|
throw new ForbiddenError(`You don't have enough privileges.`);
|
||||||
|
|
|
@ -89,6 +89,6 @@ describe('ticket addSale()', () => {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toEqual(`This ticket is locked.`);
|
expect(error.message).toEqual(`This ticket is locked`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('ticket isEditableOrThrow()', () => {
|
||||||
expect(error.message).toEqual(`This ticket is not editable.`);
|
expect(error.message).toEqual(`This ticket is not editable.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error as this ticket is locked.', async() => {
|
it('should throw an error as This ticket is locked', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
let error;
|
let error;
|
||||||
try {
|
try {
|
||||||
|
@ -57,7 +57,7 @@ describe('ticket isEditableOrThrow()', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toEqual(`This ticket is locked.`);
|
expect(error.message).toEqual(`This ticket is locked`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error as you do not have enough privileges.', async() => {
|
it('should throw an error as you do not have enough privileges.', async() => {
|
||||||
|
|
|
@ -39,6 +39,6 @@ describe('ticket recalculateComponents()', () => {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toEqual(new ForbiddenError(`This ticket is locked.`));
|
expect(error).toEqual(new ForbiddenError(`This ticket is locked`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('Ticket transferClient()', () => {
|
||||||
error = e;
|
error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error.message).toEqual(`This ticket is locked.`);
|
expect(error.message).toEqual(`This ticket is locked`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be assigned a different clientFk', async() => {
|
it('should be assigned a different clientFk', async() => {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"user": {
|
"user": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "VnUser",
|
"model": "VnUser",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "workerFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.50.01",
|
"version": "24.02.01",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.50.01",
|
"version": "24.02.01",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.2.2",
|
"axios": "^1.2.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.52.01",
|
"version": "24.02.01",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue