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

30 lines
780 B
JavaScript
Raw Normal View History

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: {
arg: 'volumes'
},
http: {
path: `/:id/getVolume`,
verb: 'GET'
}
});
Self.getVolume = async ticketFk => {
let callMethod = `CALL vn.ticketVolume(?);`;
await Self.rawSql(callMethod, [ticketFk]);
let query = `SELECT * from vn.ticketVolume;`;
let response = await Self.rawSql(query, [ticketFk]);
return response;
};
};