-
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
Implement HasAndBelongsToMany relation #6452
Conversation
Hi @frbuceta, thanks for the PR! What's the current status? |
I have little left now, I would just have to try it |
f94eca7
to
a071cd7
Compare
dfff57b
to
f7338c5
Compare
@strongloop/loopback-maintainers can you take a look at this? |
@frbuceta thanks for the PR. Please squash your commits. If it helps you can go through the submitting PR process: https://loopback.io/doc/en/lb4/submitting_a_pr.html#6-rebasing |
Not all commits are the same but if I have to squash it, I squash it |
Thanks, have a look at this for more clarity: https://loopback.io/doc/en/lb4/submitting_a_pr.html#9-final-rebase-and-squashing-of-commits. I would squash all the commits to: |
f7338c5
to
87d725a
Compare
I have squashed all commits into one |
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.
Thank you for the PR @frbuceta ! The PR does contain the code and tests the relation needs 👍
I think there are several parts that can be polished such as reusing the code from relation hasManyThrough
as they are similar.
I like how you are improving some debug strings and file names 👍 to make the review process easier, it'd be great if you move them to another PR and maybe land it first.
RelationType, | ||
} from '../..'; | ||
|
||
export function hasAndBelongsToMany<TH extends Entity, TA extends Entity>( |
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.
Instead of having a decorator for every new relation, have you considered to move the through member to HasManyDefinition
so that we can reuse the code and have better UX. Ref: #5354
HasAndBelongsToManyDefinition | ||
>; | ||
|
||
export function resolveHasAndBelongsToManyMetadata( |
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.
I notice that the code is the same/similar to has-many-through.helpers.ts
. As these two relations are similar, maybe we can reuse the code to simplify it.
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.
Yes, much of the code I use is the same as in HasManyThrough as I explain in the description of the PR. I will work to simplify it.
Signed-off-by: Francisco Buceta <[email protected]>
87d725a
to
95c7434
Compare
This pull request has been marked stale because it has not seen activity within two months. It will be closed within 14 days of being stale unless there is new activity. |
This pull request has been closed due to continued inactivity. If you are interested in finishing the proposed changes, then feel free to re-open this pull request or open a new one. |
what happened? why is this closed and not merged? Is there a workaround for the |
Implements #2308
#2043 (comment)
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈