Skip to content

Use filters and paginate #3567

Answered by Barbapapazes
Barbapapazes asked this question in Help
Discussion options

You must be logged in to vote

So, after deep diving in the source code, I discover queryString which is exactly what I need!

const { page = 1, ...qs } = request.qs()

const profiles = await Profile.query()
  .filter(qs)
  .preload('focusInterests')
  .preload('role')
  .paginate(page, this.PER_PAGE)

profiles.baseUrl(request.url()).queryString(qs)

return view.render('pages/mee/index', { profiles })

I will check if I can find this method in the documentation, otherwise, I make a PR!

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Barbapapazes
Comment options

@Barbapapazes
Comment options

Comment options

You must be logged in to vote
1 reply
@Barbapapazes
Comment options

Answer selected by Barbapapazes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant