refs #5652 feat:itemTrash_new
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2023-09-06 09:18:28 +02:00
parent 022d3d08e6
commit 2fffa56d70
3 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,21 @@
module.exports = Self => {
Self.remoteMethod('getAddress', {
description: 'Get all activated address last year ',
accessType: 'READ',
accepts: [],
returns: {
type: ['object'],
root: true
},
http: {
path: `/getAddress`,
verb: 'GET'
}
});
Self.getAddress = async() => {
const query = `CALL vn.address_getLosesLastYear()`;
const [result] = await Self.rawSql(query);
return result;
};
};

View File

@ -1,8 +1,8 @@
const {models} = require('vn-loopback/server/server');
describe('getAddress()', () => {
describe('getAddressa()', () => {
fit('return list of address last year', async() => {
let response = await models.Collection.getAddress();
let response = await models.Addressa.getAddress();
expect(response.length).toBeGreaterThan(0);
expect(response[0].addressFk).toEqual(1);

View File

@ -3,6 +3,8 @@ let getFinalState = require('vn-loopback/util/hook').getFinalState;
let isMultiple = require('vn-loopback/util/hook').isMultiple;
module.exports = Self => {
require('../methods/address/getAddress')(Self);
Self.validateAsync('isEqualizated', cannotHaveET, {
message: 'Cannot check Equalization Tax in this NIF/CIF'
});