27 lines
693 B
JavaScript
27 lines
693 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('getVolumes', {
|
|
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'
|
|
},
|
|
http: {
|
|
path: `/:id/getVolumes`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
|
|
Self.getVolumes = async ticketFk => {
|
|
let query = `SELECT vn.ticketVolume(?) AS ticketVolumes`;
|
|
let response = await Self.rawSql(query, [ticketFk]);
|
|
return response[0];
|
|
};
|
|
};
|