Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 1x 12x 12x 12x 25x 7x 2x 5x 4x 2x 4x 2x 1x | const Role = require('../security/role'), SearchResultBase = require('./base'); class RoleSearchResult extends SearchResultBase { constructor (kuzzle, query, options, response) { super(kuzzle, query, options, response); this._searchAction = 'searchRoles'; this._scrollAction = null; // scrollRoles action does not exists in Kuzzle API. this.hits = this._response.hits.map(hit => new Role(this._kuzzle, hit._id, hit._source.controllers)); } next () { // in Kuzzle API, scrollRoles action is not available, and searchRoles allows only from and size parameters // => we deny "scroll" and "sort" parameters. if (this._request.scroll || this._request.sort) { throw new Error('only from/size params are allowed for role search'); } return super.next() .then(nextSearchResult => { if (! nextSearchResult) { return null; } nextSearchResult.hits = nextSearchResult._response.hits.map(hit => new Role(nextSearchResult._kuzzle, hit._id, hit._source.controllers)); return nextSearchResult; }); } } module.exports = RoleSearchResult; |