Enable defining scopes in `Query` class

Add a `Repository` class that takes over chaining scopes onto an
existing relation.