salix/services/loopback/common/methods/ticket/get-volume.js

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];
};
};