28 lines
790 B
JavaScript
28 lines
790 B
JavaScript
|
module.exports = Self => {
|
||
|
Self.remoteMethod('getFirstShipped', {
|
||
|
description: 'Returns the first shipped and landed possible for params',
|
||
|
accessType: '',
|
||
|
accepts: [{
|
||
|
arg: 'params',
|
||
|
type: 'object',
|
||
|
required: true,
|
||
|
description: 'agencyModeFk, addressFk, warehouseFk'
|
||
|
}],
|
||
|
returns: {
|
||
|
type: 'object',
|
||
|
root: true
|
||
|
},
|
||
|
http: {
|
||
|
path: `/getFirstShipped`,
|
||
|
verb: 'get'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Self.getFirstShipped = async params => {
|
||
|
let query = `CALL vn.agencyHourGetFirstShipped(?, ?, ?)`;
|
||
|
let [result] = await Self.rawSql(query, [params.agencyModeFk, params.addressFk, params.warehouseFk]);
|
||
|
|
||
|
return result[0];
|
||
|
};
|
||
|
};
|