如何使列表由两个ContentTypes过滤?

How can I made a listing page where the results are based on a filter on two ContentTypes?

Example:

books:
  name: Books
  singular_name: Book
  relations:
    authors:
      multiple: false
    categories:
      multiple: false

authors:
  name: Authors
  singular_name: Author

categories:
  name: Categories
  singular_name: Category

How can I make a listing of books filtered by the author and the category?

/books/(category_slug)/(author_slug)/

Edit

Ok, I found a "solution" for the route:

books:
  path: /books/{slug}/{author}
  _controller: Bolt\Controllers\Frontend::record
  contenttypeslug: categories
  author: all

Then I'm able to access both /books/foo and /books/foo/bar. And in the template I can reach author by app.request.attributes.get('author').

Now the problem is how to fetch/filter books by the two ContentTypes...

Edit 2

Well, I reach this at the end to filter, not sure if is the best way, don't look like:

{% set author_slug = app.request.attributes.get('author') %}
{% set books = category.related('books') %}
{% for book in books %}
    {% set author = book.related('authors')[0] %}
    {% if author_slug == author.slug or author_slug == 'all' %}
        My filtered book {{ book.title }}
    {% endif %}
{% endfor %}

Are this the best approach?