feat roadmap refs #7195
gitea/salix/pipeline/pr-dev Build queued... Details

This commit is contained in:
Sergio De la torre 2024-07-02 12:03:21 +02:00
parent 08cf79b09b
commit e1b6ba4276
2 changed files with 7 additions and 7 deletions

View File

@ -1,12 +1,12 @@
module.exports = Self => {
Self.remoteMethod('getPalletMatchState', {
description: 'Get list of pallet from roadMapStop with true or false if state is matched',
description: 'Get list of pallet from truckFk with true or false if state is matched',
accessType: 'WRITE',
accepts: [{
arg: 'roadMapStopFk',
arg: 'truckFk',
type: 'number',
required: true,
description: 'The roadmapFk id'
description: 'The truckFk id'
},
{
arg: 'state',
@ -24,7 +24,7 @@ module.exports = Self => {
}
});
Self.getPalletMatchState = async(roadMapStopFk, state, options) => {
Self.getPalletMatchState = async(truckFk, state, options) => {
const myOptions = {};
if (typeof options == 'object')
@ -54,7 +54,7 @@ module.exports = Self => {
LEFT JOIN totalPalletExpedition tpe ON tpe.expedition = t.expedition
LEFT JOIN totalPalletExpeditionCode tpec ON tpec.expedition = t.expedition
GROUP BY t.pallet;`,
[roadMapStopFk, state],
[truckFk, state],
myOptions);
return result;

View File

@ -3,9 +3,9 @@ const {models} = require('vn-loopback/server/server');
describe('roadMapStop getPalletMatchState()', () => {
it('should return list of pallet with true or false if state is matched', async() => {
const roadmapStopFk = 1;
const truckFk = 1;
const state = 'ON DELIVERY';
const result = await models.RoadmapStop.getPalletMatchState(roadmapStopFk, state);
const result = await models.RoadmapStop.getPalletMatchState(truckFk, state);
expect(result[0].hasMatchStateCode).toBe(1);
});