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-11 16:16:49 +02:00
parent 8218eb2a6b
commit 5f5a0645be
3 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLosesLastYear`()
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`address_getLoses`()
BEGIN
SELECT t.addressFk , a.nickname, c.name
FROM ticket t
@ -8,7 +8,6 @@ BEGIN
JOIN client c ON a.clientFk = c.id
WHERE c.typeFk = 'loses'
AND a.isactive = 1
AND t.created >= (CURRENT_DATE() - INTERVAL 1 YEAR)
GROUP BY t.addressFk;
END$$
DELIMITER ;

View File

@ -1,6 +1,6 @@
module.exports = Self => {
Self.remoteMethod('getAddress', {
description: 'Get all activated address last year ',
description: 'Get all activated address client active',
accessType: 'READ',
accepts: [],
returns: {
@ -14,7 +14,7 @@ module.exports = Self => {
});
Self.getAddress = async() => {
const query = `CALL vn.address_getLosesLastYear()`;
const query = `CALL vn.address_getLoses()`;
const [result] = await Self.rawSql(query);
return result;
};

View File

@ -1,7 +1,7 @@
const {models} = require('vn-loopback/server/server');
describe('getAddress()', () => {
it('return list of address last year', async() => {
fit('return list of address last year', async() => {
let response = await models.Address.getAddress();
expect(response.length).toBeGreaterThan(0);