7729-devToTest_2430 #2739

Merged
alexm merged 339 commits from 7729-devToTest_2430 into test 2024-07-16 07:11:37 +00:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit e1b6ba4276 - Show all commits

View File

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

View File

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