-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HasManyThrough using HasMany #2359
HasManyThrough using HasMany #2359
Conversation
I've separated the hasMany and hasManyThrough repository factories. Please reference the following two comments. |
7a47883
to
38bebcb
Compare
38bebcb
to
38e2ab0
Compare
@codejamninja thank you for the pull request, this is great effort! I'll need to set aside larger chunk of time to review the changes, hopefully later this week 🤞
Please add integration-level tests for the new repository factory to https://github.com/strongloop/loopback-next/blob/master/packages/repository/src/__tests__/integration/repositories/relation.factory.integration.ts I think we should also copy https://github.com/strongloop/loopback-next/blob/master/packages/repository/src/__tests__/acceptance/has-many.relation.acceptance.ts into |
Ok, thanks @bajtos |
I just added integration level tests and acceptance tests. They are all passing for me. |
Anyone wanting to get early access to the hasManyThrough relation (or anyone wanting to test it), you can install it the following way. npm install --save @loopback/repository@git+https://[email protected]/codejamninja/loopback-next.git#npm/has-many-through or add the following to your package.json file {
"dependencies": {
"@loopback/repository": "git+https://[email protected]/codejamninja/loopback-next.git#npm/has-many-through"
}
} |
I just added some basic usage docs for hasManyThrough |
@codejamninja Thank you for the contribution. I'll try to find some time to go over the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start, @codejamninja!
I like @hasMany(() => Customer, {through () => Order})
API and also the repository APIs as used by relation consumers (e.g. in Controllers) 👍
However, I feel we need to rework and improve the design and the interactions between the repository factory, the has-many-through constrain and HasManyThroughRepository, PTAL at my last comment below.
packages/repository/src/__tests__/integration/repositories/relation.factory.integration.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/__tests__/unit/repositories/has-many-through-repository-factory.unit.ts
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through-repository.factory.ts
Outdated
Show resolved
Hide resolved
packages/repository/src/relations/has-many/has-many-through.repository.ts
Outdated
Show resolved
Hide resolved
Hey, Edit: |
This is my understanding:
@raymondfeng is that correct? |
You are right in that aspect. What about the API though? |
I think that's something we need to find out while working on |
I don't anticipate any problems. |
@codejamninja what's the status of this pull request? Do you need any additional information or feedback from us? I just want to ensure the progress is not blocked by us. |
@bajtos, thanks for asking. I am not blocked. The holdup is my schedule. I should get back to this sometime towards the end of the week. |
I like a lot, but unfortunately I haven't the required informations about how to implement this feature |
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of #2359 and implements a step from #2359 (comment).
The hasManyThrough repository interface defines the actions that can be performed on a many-to-many model relation. This PR is a continuation of loopbackio#2359 and implements a step from loopbackio#2359 (comment).
Hello guys ! Do you know when this feature is going to be available in the framework ? thanks in advance. |
@MacGyver26, I believe #4438 takes over the implementation of the hasManyThrough relation. |
The implementation and documentation are merged, closing the issue. |
This pull request attempts to set up the hasManyThrough relation using the hasMany relation. It does it using a
through
property that can be provided to the@hasMany()
decorator.I chose to setup the hasManyThrough this way in an attempt to stick to the existing loopback hasManyThrough spec.
https://loopback.io/doc/en/lb3/HasManyThrough-relations.html#defining-a-hasmanythrough-relation
See also #2264
See also #2356
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated