Add findByForeignKeys
helper (initial version)
#3443
Labels
feature
Relations
Model relations (has many, etc.)
Repository
Issues related to @loopback/repository package
Milestone
Implement a new helper function
findByForeignKeys
, it will become a part of a public API of@loopback/repository
.Signature:
The initial version should be simple, "inq splitting" and additional "scope" constraints are out of scope of this task.
Example implementation - I think it pretty much covers the full scope of this task, but obviously we need to add test coverage as explained in the acceptance criteria. It would be also great to throw an error if
scope
argument was provided, because we don't support scopes yet.See #3387 for more details & a prototype implementation.
Acceptance criteria
Beside the implementation, it's important to create testing infrastructure that will make it easy to add new tests in the future. There should be two kinds of tests:
packages/repository
, these tests should mocktargetRepository
. By using a mock repository, we can assert on how many queries are called, inject errors to verify how are they handled, etc.packages/repository-tests
, these tests will call real repository class & database, we will invoke them against different connectors (MySQL, MongoDB, and so on).Out of scope
inq
splitting infindByForeignKeys
Supportinq
splitting infindByForeignKeys
#3444The text was updated successfully, but these errors were encountered: