32 lines
804 B
JavaScript
32 lines
804 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('getVolume', {
|
|
description: 'Returns the volumes of a ticket',
|
|
accessType: 'READ',
|
|
accepts: [{
|
|
arg: 'id',
|
|
type: 'number',
|
|
required: true,
|
|
description: 'ticket id',
|
|
http: {source: 'path'}
|
|
}],
|
|
returns: {
|
|
type: ['Object'],
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/:id/getVolume`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
|
|
Self.getVolume = async(ticketFk, options) => {
|
|
const myOptions = {};
|
|
|
|
if (typeof options == 'object')
|
|
Object.assign(myOptions, options);
|
|
|
|
return Self.rawSql(`SELECT * FROM vn.saleVolume
|
|
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
|
};
|
|
};
|