salix/services/loopback/common/methods/order/getVolumes.js

26 lines
641 B
JavaScript
Raw Normal View History

2018-07-24 10:57:07 +00:00
module.exports = Self => {
2018-08-08 14:15:53 +00:00
Self.remoteMethod('getVolumes', {
2018-07-24 10:57:07 +00:00
description: 'Returns the volumes of a order',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'order id',
http: {source: 'path'}
}],
returns: {
arg: 'volumes'
},
http: {
path: `/:id/getVolumes`,
verb: 'GET'
}
});
2018-08-08 14:15:53 +00:00
Self.getVolumes = async orderFk => {
2018-07-24 10:57:07 +00:00
let [volume] = await Self.rawSql(`CALL vn.orderListVolume(?)`, [orderFk]);
return volume;
};
};