2018-03-22 14:06:21 +00:00
|
|
|
module.exports = Self => {
|
2018-04-03 14:10:39 +00:00
|
|
|
Self.remoteMethod('getVolume', {
|
2018-03-22 14:06:21 +00:00
|
|
|
description: 'Returns the volumes of a ticket',
|
|
|
|
accessType: 'READ',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'id',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
description: 'ticket id',
|
|
|
|
http: {source: 'path'}
|
|
|
|
}],
|
|
|
|
returns: {
|
2018-04-03 14:10:39 +00:00
|
|
|
arg: 'volumes'
|
2018-03-22 14:06:21 +00:00
|
|
|
},
|
|
|
|
http: {
|
2018-04-03 14:10:39 +00:00
|
|
|
path: `/:id/getVolume`,
|
2018-03-22 14:06:21 +00:00
|
|
|
verb: 'GET'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-04-03 14:10:39 +00:00
|
|
|
Self.getVolume = async ticketFk => {
|
|
|
|
let callMethod = `CALL vn.ticketVolume(?);`;
|
|
|
|
await Self.rawSql(callMethod, [ticketFk]);
|
|
|
|
|
|
|
|
let query = `SELECT * from vn.ticketVolume;`;
|
2018-03-22 14:06:21 +00:00
|
|
|
let response = await Self.rawSql(query, [ticketFk]);
|
2018-04-03 14:10:39 +00:00
|
|
|
return response;
|
2018-03-22 14:06:21 +00:00
|
|
|
};
|
|
|
|
};
|