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

Join list of objects #121

Open
JakNowy opened this issue Jul 4, 2024 · 3 comments
Open

Join list of objects #121

JakNowy opened this issue Jul 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@JakNowy
Copy link
Contributor

JakNowy commented Jul 4, 2024

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,
        },
    ]
}
@JakNowy JakNowy added the enhancement New feature or request label Jul 4, 2024
@JakNowy JakNowy changed the title Join mul Get_joined_list Jul 4, 2024
@JakNowy JakNowy changed the title Get_joined_list Join list of objects Jul 4, 2024
@igorbenav
Copy link
Owner

igorbenav commented Jul 9, 2024

Can you please send code to reproduce and output?

@JakNowy
Copy link
Contributor Author

JakNowy commented Jul 24, 2024

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?

@neatek
Copy link

neatek commented Sep 17, 2024

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

3 participants