transaction activeWithBuyer.js
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-11-15 14:50:02 +01:00
parent 73211c5b3b
commit ec25df39e4
2 changed files with 13 additions and 9 deletions

View File

@ -813,7 +813,7 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT'), (13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT'),
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT'), (14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT'),
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), (15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'),
(16, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'), (16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB'),
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT'); (71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT');
-- Update the taxClass after insert of the items -- Update the taxClass after insert of the items

View File

@ -1,4 +1,3 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethod('activeWithBuyer', { Self.remoteMethod('activeWithBuyer', {
description: 'Returns active workers in itemType', description: 'Returns active workers in itemType',
@ -19,13 +18,18 @@ module.exports = Self => {
} }
}); });
Self.activeWithBuyer = async filter => { Self.activeWithBuyer = async(filter, options) => {
const query = const myOptions = {};
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname
FROM worker w
JOIN itemType i ON i.workerFk = w.id
JOIN account.user u ON u.id = w.id`;
return Self.activeWorkers(query, filter); if (typeof options == 'object')
Object.assign(myOptions, options);
const query =
`SELECT DISTINCT w.id, w.firstName, w.lastName, u.name, u.nickname
FROM worker w
JOIN itemType i ON i.workerFk = w.id
JOIN account.user u ON u.id = w.id`;
return Self.activeWorkers(query, filter, myOptions);
}; };
}; };