hello. Is it possible to avoid the nested object p...
# orm-help
e
hello. Is it possible to avoid the nested object pattern that occurs when using complex join queries? Too much depth makes it difficult to understand the code. Any good examples of this?
n
Hey 👋 Do you mean you want to avoid using nested
include
clauses?
e
@Nurul Well... rather than avoiding it, I’d like to put it to good use. The depth is too deep right now, and the type declaration makes me so hard when moving around variables in Typescript. thank you for your reply.
n
You might be interested in Fluent API Can you have a look?
1
e
@Nurul I’ll check it out thanks
@Nurul Ummm... I’m trying to use it, but it’s a situation where the whole is needed rather than just getting the relational table.
n
Can you please share your query on what you are trying to achieve?
e
For example, I’m using these queries...
Copy code
where: {
         type,
         card_tier: {
           label: {
             in: ["Common", "Special"],
           },
         },
         id: {
           in: _.uniq(cardIdList),
         },
       },
       include: {
         _count: {
           select: {
             card_moment: true,
           },
         },
         card_tier: true,
         player_game_data: {
           include: {
             player_season_data: {
               include: {
                 team: true,
                 position: true,
                 player: true,
                 season_data: true,
               },
             },
             game: true,
           },
         },
         card_situation_tag: true,
         cards_badges: {
           include: {
             card_badge: true,
           },
         },
         card_collection: true,
         card_image: true,
         card_moment: true,
       },
       take: 8,
@Nurul Help reminder) Could you possibly give an answer?
n
Hey 👋 I can see that your query is getting complex but as of now I don’t think there would be any other way to simplify this. Are you facing any performance issue while executing this query?
e
No, rather than a performance problem, I thought it was difficult for people to see. I also thought that there would be no improvement plan, but I was just trying to figure out if there was a way. Thanks for the reply.
🙌 1
n
I’ll pass on this feedback to our team though to discuss how we could improve the experience in these scenarios
❤️ 1
e
thank you please tell me if i can help