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

Feature Request: Join Filter (ON clause) #38

Closed
ZaidMaslouhi opened this issue Apr 2, 2024 · 2 comments
Closed

Feature Request: Join Filter (ON clause) #38

ZaidMaslouhi opened this issue Apr 2, 2024 · 2 comments

Comments

@ZaidMaslouhi
Copy link

Current Functionality:

NestJS CRUD currently allows for joining related entities in queries. However, there is limited control over the join condition itself.

Request:

This feature request proposes the addition of join filters, allowing users to specify a WHERE condition within the ON clause of a join.

Benefits:

  • Increased flexibility in querying related data.
  • Ability to create more complex and specific queries involving joins.

Implementation:

Introduce a new property within the QueryJoin type of crud-request. This property could be named on and accept array of objects of type QueryFilter representing the WHERE condition for the join.

Example:

export declare type QueryJoin = {
  field: string;
  select?: QueryField[];
  on?: QueryFilter[]; // New property
};

This functionality would allow users to specify conditions within the join, like so:

query.setJoin({
    field: 'author',
    select: ['name', 'image'],
    on: [{ field: 'author.id', operator: 'eq', value: 123 }], // Filter by specific author ID
});

By implementing join filters, dataui-nestjs-crud would provide greater control over join conditions, enabling more sophisticated data retrieval scenarios.

@zaro
Copy link
Member

zaro commented Apr 9, 2024

@ZaidMaslouhi Thank you for the contribution. PR was just merged and the new 5.3.4 release includes it.

@zaro zaro closed this as completed Apr 9, 2024
@ZaidMaslouhi
Copy link
Author

You are welcome! glad to see it in 5.3.4 🚀

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

No branches or pull requests

2 participants