Feature Request: Join Filter (ON clause)
Closed this issue · 2 comments
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.
@ZaidMaslouhi Thank you for the contribution. PR was just merged and the new 5.3.4
release includes it.
You are welcome! glad to see it in 5.3.4 🚀