salix/modules/order/back/methods/order/getVolumes.js

31 lines
783 B
JavaScript

module.exports = Self => {
Self.remoteMethod('getVolumes', {
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'
}
});
Self.getVolumes = async(orderFk, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const [volume] = await Self.rawSql(`CALL vn.orderListVolume(?)`, [orderFk], myOptions);
return volume;
};
};