added missing method getAgenciesWithWarehouse

This commit is contained in:
Gerard 2019-01-11 07:36:38 +01:00
parent ce0d80f019
commit 81ef984597
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
module.exports = Self => {
Self.remoteMethod('getAgenciesWithWarehouse', {
description: 'Returns a list of agencies that can land a shipment on a day for an address and a warehouse',
accessType: '',
accepts: [{
arg: 'filter',
type: 'object',
required: true,
description: 'addressFk'
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/getAgenciesWithWarehouse`,
verb: 'get'
}
});
Self.getAgenciesWithWarehouse = async filter => {
let query = `CALL vn.agencyHourGetWarehouse(?, ?, ?)`;
let result = await Self.rawSql(query, [filter.addressFk, filter.landed, filter.warehouseFk]);
return result;
};
};

View File

@ -1,4 +1,5 @@
module.exports = Self => {
require('../methods/agency/landsThatDay')(Self);
require('../methods/agency/getFirstShipped')(Self);
require('../methods/agency/getAgenciesWithWarehouse')(Self);
};