Merge branch 'dev' into 6493-refactorizar-procedimientos-vn2008-parte_2
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Juanjo Breso 2024-04-23 10:16:27 +00:00
commit 79172ef288
9 changed files with 92 additions and 67 deletions

View File

@ -5,7 +5,9 @@ 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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [24.18.01] - 2024-05-02
## [24.20.01] - 2024-05-14
## [24.18.01] - 2024-05-07
## [24.16.01] - 2024-04-18

View File

@ -12,8 +12,8 @@ module.exports = Self => {
http: {
path: `/renewToken`,
verb: 'POST'
}
});
},
accessScopes: ['DEFAULT', 'read:multimedia']});
Self.renewToken = async function(ctx) {
const {accessToken: token} = ctx.req;

View File

@ -2617,7 +2617,7 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo
UPDATE `vn`.`invoiceIn`
SET isBooked = TRUE
WHERE id IN (2, 5, 7, 8, 9, 10);
WHERE id IN (5, 7, 8, 9, 10);
DELIMITER $$
CREATE PROCEDURE `tmp`.`ticket_recalc`()

View File

@ -0,0 +1,12 @@
CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`farmingFk` int(10) unsigned NOT NULL,
`deliveryNoteFk` int(11) NOT NULL,
`amount` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `farmingDeliveryNoteFk_FK` (`deliveryNoteFk`),
KEY `farmingDeliveryNoteFk_FK_1` (`farmingFk`),
CONSTRAINT `farmingDeliveryNoteFk_FK` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`),
CONSTRAINT `farmingDeliveryNoteFk_FK_1` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`)
);

View File

@ -76,6 +76,6 @@ describe('Entry basic data path', () => {
expect(confirmed).toBe('checked');
expect(inventory).toBe('checked');
expect(raid).toBe('checked');
expect(booked).toBe('checked');
expect(booked).toBe('unchecked');
});
});

View File

@ -1,5 +1,6 @@
import ngModule from '../module';
const TOKEN_MULTIMEDIA = 'vnTokenMultimedia';
const TOKEN = 'vnToken';
/**
* Saves and loads the token for the current logged in user.
*
@ -58,8 +59,8 @@ export default class Token {
}
getStorage(storage) {
this.token = storage.getItem('vnToken');
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
this.token = storage.getItem(TOKEN);
this.tokenMultimedia = storage.getItem(TOKEN_MULTIMEDIA);
if (!this.token) return;
const created = storage.getItem('vnTokenCreated');
this.created = created && new Date(created);
@ -67,15 +68,15 @@ export default class Token {
}
setStorage(storage, token, tokenMultimedia, created, ttl) {
storage.setItem('vnTokenMultimedia', tokenMultimedia);
storage.setItem('vnToken', token);
storage.setItem(TOKEN_MULTIMEDIA, tokenMultimedia);
storage.setItem(TOKEN, token);
storage.setItem('vnTokenCreated', created.toJSON());
storage.setItem('vnTokenTtl', ttl);
}
removeStorage(storage) {
storage.removeItem('vnToken');
storage.removeItem('vnTokenMultimedia');
storage.removeItem(TOKEN);
storage.removeItem(TOKEN_MULTIMEDIA);
storage.removeItem('vnTokenCreated');
storage.removeItem('vnTokenTtl');
}
@ -96,9 +97,9 @@ export default class Token {
this.checking = true;
const renewPeriod = Math.min(this.ttl, this.renewPeriod) * 1000;
const maxDate = this.created.getTime() + renewPeriod;
const now = new Date();
const now = new Date().getTime();
if (now.getTime() <= maxDate) {
if (now <= maxDate) {
this.checking = false;
return;
}
@ -106,7 +107,17 @@ export default class Token {
this.$http.post('VnUsers/renewToken')
.then(res => {
const token = res.data;
this.set(token.id, now, token.ttl, this.remember);
const tokenMultimedia =
localStorage.getItem(TOKEN_MULTIMEDIA)
?? sessionStorage.getItem(TOKEN_MULTIMEDIA);
return this.$http.post('VnUsers/renewToken', null, {
headers: {Authorization: tokenMultimedia}
})
.then(({data}) => {
const tokenMultimedia = data;
this.set(token.id, tokenMultimedia.id, new Date(), token.ttl, this.remember);
});
})
.finally(() => {
this.checking = false;
@ -119,4 +130,4 @@ export default class Token {
}
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
ngModule.service('vnToken', Token);
ngModule.service(TOKEN, Token);

View File

@ -158,7 +158,7 @@ describe('InvoiceIn filter()', () => {
const result = await models.InvoiceIn.filter(ctx, {}, options);
expect(result.length).toEqual(4);
expect(result.length).toEqual(5);
await tx.rollback();
} catch (e) {
@ -180,7 +180,7 @@ describe('InvoiceIn filter()', () => {
const result = await models.InvoiceIn.filter(ctx, {}, options);
expect(result.length).toEqual(6);
expect(result.length).toEqual(5);
expect(result[0].isBooked).toBeTruthy();
await tx.rollback();

View File

@ -45,7 +45,7 @@ module.exports = Self => {
wh.name warehouseName,
tob.description observationDelivery,
tob2.description observationDropOff,
tob2.id,
tob2.id observationId,
a.street,
a.postalCode,
a.city,

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "24.18.0",
"version": "24.20.0",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",