Join list of objects
Is your feature request related to a problem? Please describe.
For OneToMany relationships, using get_joined or get_multi_joined returns one nested object, while in some cases I'd like to return all related objects.
Describe the solution you'd like fastcrud.get_joined_list(...) ->
{
"id": 1,
"joined_objects": [
{
"id":1
"name": Donald,
},
{
"id":2
"name": Joe,
},
]
}
Can you please send code to reproduce and output?
What I exactly mean here is to introduce fastcrud.get_joined_many() method which would return an object with a list of relationships.
So on top of existing fastcrud.get_joined() ->
{
"id": 1,
"joined_object": { # just 1 relationship object
"id":1
"name": Donald,
}
}
we add fastcrud.get_joined_many() ->
{
"id": 1,
"joined_objects": [ # multiple relationship objects
{
"id":1
"name": Donald,
},
{
"id":2
"name": Joe,
},
]
}
Does it make sense to you to add such feature or it's too compllicated?
Maybe its about relationship_type?
relationship_type: Specifies the relationship type, such as "one-to-one" or "one-to-many". Default is "one-to-one". https://igorbenav.github.io/fastcrud/advanced/joins/#handling-one-to-one-and-one-to-many-joins-in-fastcrud https://igorbenav.github.io/fastcrud/advanced/joins/#one-to-many-relationships https://igorbenav.github.io/fastcrud/advanced/joins/#many-to-many-relationships-with-get_multi_joined