Skip to content
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

Enhanced Data Retrieval: Implement Join Conditions #43

Merged
merged 10 commits into from
Apr 9, 2024

Conversation

ZaidMaslouhi
Copy link

Description:

This PR introduces join filters for dataui-nestjs-crud, empowering you with greater control over related data queries. Users can now specify WHERE conditions within the ON clause of joins, enabling the creation of more intricate and specific queries.

Key Improvements:

  • Increased Flexibility: Craft complex queries by filtering related entities based on custom conditions.
  • Enhanced Data Retrieval: Retrieve specific subsets of related data, improving efficiency and focus.

Implementation Details:

  • Introduces a new 'ON' property to the QueryJoin interface within @dataui/crud-request.
  • Leverages this property to specify 'ON' conditions for joins.
  • Implements comprehensive unit and integration tests for guaranteed functionality.

Benefits:

  • Simplifies querying related data with precise control.
  • Enables more efficient and targeted data retrieval.
  • This PR elevates dataui-nestjs-crud's capabilities by empowering you with flexible join filtering.

#38

@coveralls
Copy link

coveralls commented Apr 6, 2024

Pull Request Test Coverage Report for Build 8606035890

Details

  • 33 of 34 (97.06%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 98.589%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/crud-request/src/request-query.validator.ts 1 2 50.0%
Totals Coverage Status
Change from base Build 8555637572: -0.08%
Covered Lines: 1270
Relevant Lines: 1278

💛 - Coveralls

@zaro
Copy link
Member

zaro commented Apr 8, 2024

@ZaidMaslouhi Thank you for the good work.

I hope you are willing to add at least one example in the documenation here : https://github.com/gid-oss/dataui-nestjs-crud/blob/master/docs/requests.md#join !

Apart from that it's good to merge and release and I will do so soon after I hear from you on the docs.

@Dragomir-Ivanov
Copy link

While at it guys, I really think that relations need to have ability to be paginated/sorted as well.
Example, getting an User entity, and jointing Comment entity. But get last 10 comments only.

Oh, Hi @zaro ! What a small world. We were colleagues at Concurrent ages ago :)

@ZaidMaslouhi
Copy link
Author

Hi @zaro!
Absolutely, I'd be happy to add an example for the join condition on the docs.

@zaro zaro merged commit d1e1357 into gid-oss:master Apr 9, 2024
2 checks passed
@zaro
Copy link
Member

zaro commented Apr 9, 2024

@Dragomir-Ivanov Hey :) Indeed , quite some time ago.

Regarding your suggestion, this is not the place to discuss it. If you want maybe open a new issue where this can be discussed properly. Because if I understand you correctly, this is actually quite complicated feature and most certainly not possible with a single SQL query. So maybe also provide a simple example in plain SQL how it is supposed to work.

Keep in mind that this CRUD library is just a think layer over TypeORM and TypeORM itself doesn't have support for what you are requesting.

Happy to hear more for you .

@afilp
Copy link

afilp commented Jun 1, 2024

@ZaidMaslouhi FYI: I think this is related to the docs you wrote?

#53

Maybe you can do the change if this is what happening?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants