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]); return total.total; }; };