TriPSs / nestjs-query

Easy CRUD for GraphQL.
https://tripss.github.io/nestjs-query/
MIT License
164 stars 46 forks source link

Infinite depth in DTO but not in suscriptions #220

Open VelaJafet opened 10 months ago

VelaJafet commented 10 months ago

Hello, i'm reading your documentation.

I read that I can add the next to modify the filterInput in the DTO, it works!

image

And in the suscriptions I can filter but is setup like filterDepth: 0 'cause I can't access to the direct relations

image

image

Have you thought about to add the same logic to the filter of suscriptions? I have to do some weird things to filter created/updated things in front end, for example validate that the createdElement has the same company with a useEffect instead just get the createdElement that is mine

TriPSs commented 10 months ago

That's a good question, I'm not sure we can support inifity depth as those filters (If I remember correctly) are stringified and stored in a map, so that could potentially bring some issues.

What would the needed depth be for your use case?

TriPSs commented 10 months ago

The filtering on subscriptions also wrok different as in they are not filtered on the database currently but on the plain object itself, so that would maybe explain why you can't filter on relations.

PS: I'm on my phone so can't check how to implementation currently is.

VelaJafet commented 10 months ago

That's a good question, I'm not sure we can support inifity depth as those filters (If I remember correctly) are stringified and stored in a map, so that could potentially bring some issues.

What would the needed depth be for your use case?

I have the next entity:

Log:

I just can access to the filter strings, numbers but not to the directs relations like company->id, it seems like depthFilter is 0 :s, i just need depthFilter: 1 or 2