28 lines
733 B
JavaScript
28 lines
733 B
JavaScript
|
module.exports = Self => {
|
||
|
Self.remoteMethod('landsThatDay', {
|
||
|
description: 'Returns a list of agencies that can land a shipment on a day for an address',
|
||
|
accessType: '',
|
||
|
accepts: [{
|
||
|
arg: 'filter',
|
||
|
type: 'object',
|
||
|
required: true,
|
||
|
description: 'addressFk'
|
||
|
}],
|
||
|
returns: {
|
||
|
type: 'object',
|
||
|
root: true
|
||
|
},
|
||
|
http: {
|
||
|
path: `/landsThatDay`,
|
||
|
verb: 'get'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Self.landsThatDay = async filter => {
|
||
|
let query = `CALL vn.agencyHourGetAgency(?, ?)`;
|
||
|
let result = await Self.rawSql(query, [filter.addressFk, filter.landed]);
|
||
|
|
||
|
return result;
|
||
|
};
|
||
|
};
|