salix/services/loopback/common/methods/order/getTotal.js

29 lines
700 B
JavaScript
Raw Normal View History

2018-07-20 14:32:34 +00:00
module.exports = Self => {
Self.remoteMethod('getTotal', {
description: 'Gets the total for an order',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'ticket id',
http: {source: 'path'}
}],
returns: {
type: 'number',
root: true
},
http: {
path: `/:id/getTotal`,
verb: 'GET'
}
});
Self.getTotal = async orderFk => {
let query = `SELECT hedera.orderGetTotal(?) total;`;
let [total] = await Self.rawSql(query, [orderFk]);
2018-07-24 10:57:07 +00:00
2018-10-10 10:55:04 +00:00
return total.total;
2018-07-20 14:32:34 +00:00
};
};