loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

feat: support non-primary reference keys of source and target model for hasManyThrough relation

Open aaqilniz opened this issue 1 year ago • 4 comments

This PR will provide support for non-primary key references of source & target models in case of hasManyThrough relation.

Checklist

  • [x] DCO (Developer Certificate of Origin) signed in all commits
  • [x] npm test passes on your machine
  • [x] New tests added or existing tests modified to cover all changes
  • [x] Code conforms with the style guide
  • [ ] API Documentation in code was updated
  • [x] Documentation in /docs/site was updated
  • [x] Affected artifact templates in packages/cli were updated
  • [ ] Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

aaqilniz avatar Apr 08 '23 15:04 aaqilniz

Pull Request Test Coverage Report for Build 7687463955

  • -4 of 4 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 55.344%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/repository/src/relations/has-many/has-many-through.helpers.ts 0 4 0.0%
<!-- Total: 0 4
Files with Coverage Reduction New Missed Lines %
packages/repository/src/relations/has-many/has-many-through.helpers.ts 1 7.59%
<!-- Total: 1
Totals Coverage Status
Change from base Build 7663796800: -0.03%
Covered Lines: 9563
Relevant Lines: 12459

💛 - Coveralls

coveralls avatar Apr 09 '23 13:04 coveralls

Hi, @samarpanB. Can you please have look at this PR?

aaqilniz avatar Jan 17 '24 14:01 aaqilniz

Can you share an example where this might be useful ? I believe hasManyThrough need to be mostly with primary keys only.

samarpanB avatar Jan 18 '24 13:01 samarpanB

@samarpanB. We can create hasManyThrough (or any other relation) with a unique key - which can be a non-primary key.

aaqilniz avatar Feb 05 '24 18:02 aaqilniz