Skip to content

Custom SQLComparisonBuilder Not Applied to Joined/Related Entities #381

@ykyaw

Description

@ykyaw

Is your feature request related to a problem? Please describe.
I've implemented a custom SQLComparisonBuilder that extends the default one to provide SQL transformations for certain comparison operations. This works correctly for direct entity properties but not when filtering on joined/related entities.

For example, when filtering EntityA with a property from EntityB (where EntityB is a related entity), my custom builder isn't used for the entityB.property comparison.

Have you read the Contributing Guidelines?

Yes

Describe the solution you'd like
A way to apply custom SQL comparison builders to joined/related entity properties. Ideally, when a custom SQLComparisonBuilder is registered through the filterQueryBuilder option, it would be consistently used for any matching operation throughout the entire query, including those on related entities.

Describe alternatives you've considered
I've implemented an interceptor workaround that manually queries the related entity and transform the filter.
This works but requires interceptors for each relation where I need the custom comparison behavior.

Additional context
I'm using nestjs-query-typeorm with filterQueryBuilder: new CustomFilterQueryBuilder(repository) in my services.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions