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

Extend nested filter input-types to allow filter-depth configuration per relation. #145

Open
hedwiggggg opened this issue May 30, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@hedwiggggg
Copy link
Contributor

hedwiggggg commented May 30, 2023

Extend nested filter input-types (#143) to allow filter-depth configuration per relation.

@FilterableRelation('relation', () => Relation, {
  // This one does not work yet
  filterDepth: 2,
})

Describe the solution you'd like

Requires further customization in the /nestjs-query/packages/query-graphql/src/types/query/filter.type.ts file. At Object.keys(filterableRelations).forEach((field) => { the filterDepth of the relation should be considered (only if set), not the filterDepth of the parent element.

// Example-A.entity.ts
@ObjectType('EntityA')
@FilterableRelation('relation', () => relation)
class EntityA { /* ... */ }

// leads to
// input EntityAFilter {
//    # should generate depending on the `filterDepth` of `EntityA`
//    relation: EntityAFilterRelationFilter
// }
// Example-B.entity.ts
@ObjectType('EntityB')
@FilterableRelation('relation', () => relation, { filterDepth: 2 )
class EntityB { /* ... */ }

// leads to
// input EntityBFilter {
//     # should generate a filter type of depth 2
//     relation: EntityBFilterRelationFilter
// }

This is not a critical feature for me personally, so I will look at this in the future when I have more resources available again.

@hedwiggggg hedwiggggg added the enhancement New feature or request label May 30, 2023
@hedwiggggg hedwiggggg changed the title Extend nested filter input-types (https://github.com/TriPSs/nestjs-query/pull/143) to allow filter-depth configuration per relation. Extend nested filter input-types to allow filter-depth configuration per relation. May 30, 2023
@qashlan
Copy link

qashlan commented Jun 30, 2024

any updates regarding this

@hedwiggggg
Copy link
Contributor Author

Nope, sorry. Still not really a critical feature for me. But feel free to create a PR, if you need this feature 😄 @qashlan

@qashlan
Copy link

qashlan commented Jul 8, 2024

@hedwiggggg sure, will put sometime into this.

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

No branches or pull requests

2 participants