Closed Migushthe2nd closed 3 years ago
Are you asking if you can supply additional filter params on top of the query?
This is actually possible if you instead use const qb = PerchQueryBilder.generateQueryBuilder(this.bookRepository, info)
and attach additional AND WHERE clauses. The generateQueryBuilder method returns a TypeORM QueryBuilder
Ah I see, I can always use the general querybuilder, however, I prefer the simplicity of Repository.find()
.
This allows one to do quite a lot actually, even filter on nested types.
A simple example would be:
bookRepository.find({
where: {
status: In(["Free", "Sale"])
publisher: {
id: "5b"
}
}
})
Edit:
The QueryBuilder
's where()
method accepts an object of type FindOptions<Type>
.
(queryBuilder.where(findOptions)
)
Using the built-in repository
find()
method, it is possible to find with many different options (image below)Is there a way to specify such options with
PerchQueryBuilder
?