[Enhancement]: Refactor graphql list sorting logic
Contact Details
No response
What happened?
In the graphql list endpoint that accept an sort_by parameter, we need some generic logic that can be used by all resolvers. The current implementation has an issue that is explained with the following example:
When sorting a process on multiple fields, like:
sort_by: [{"field":"productTag", "value":"FW"}, {"field":"productName": "some_name"}] the SQL statement needs a join with the ProcessSubscription and Product tables, but this join can only happen once, otherwise SQLAlchemtycan't resolve the query.
Currently, we use an internal member ._setup_joins to access the already joined tables to prevent joining the same table multiple times, but we'd better not use internal members since that is guaranteed to break at some point in the future.
We need a generic solution that will work for all resolvers with a sort_by parameter.
Version
2.2.1
What python version are you seeing the problem on?
No response
Relevant log output
No response