module.exports = Self => { Self.remoteMethod('getAddress', { description: 'Get all activated address with loses client activated', accessType: 'READ', accepts: [], returns: { type: ['object'], root: true }, http: { path: `/getAddress`, verb: 'GET' } }); Self.getAddress = async() => { let getAddressQuery = ` SELECT a.id, a.nickname FROM vn.address a JOIN vn.client c ON a.clientFk = c.id AND c.isActive <> FALSE WHERE c.typeFk = 'loses' AND a.isActive <> FALSE;`; return result = await Self.rawSql(getAddressQuery); }; };