Skip to content

Noes not include through properties when querying at a 2nd level #4

@frankorama

Description

@frankorama

we have a Team model linked to a Member model though a TeamRole model. In the TeamRole we define "canCreate", "canUpdate", etc. permissions. This is a hasManyThrough relation.

Team <--> TeamRole <--> Member

Next we have a document model, where the author property is a relation (belongsTo) Members, and the team property (belongsTo) Team.

Document.team --> Team
Document.author --> Membe

To query the documents and get the author and team, I perform the following include:
{"include":["author","team"]}
Works great.

Now i want to get the team members at the same time:
{"include":["author",{"team":"members"}]}
Now I have the team with a list of members, but I don't have any data from the TeamRole model.

I tried using the mixin, but without success. Is there a different syntax that I'm not aware of?

attempt 1:
{"include":["author",{"team": "members", "includeThrough":true}]}

attempt 2:

{
  "include":{
    "relation":"team",
    "scope":{
      "include":{ 
        "relation":"members"
        },
      "includeThrough":true
    }
  }
}

Is your mixing meant to perform this way? Is it possible to get the member roles when including team from another model?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions