Skip to content

Using the include filter in hasOne relationship #2304

@shalkam

Description

@shalkam

Hi,
I've created a simple has one realtionship between two models (a user and a team ) like this :

    "managedTeam": {
      "type": "hasOne",
      "model": "Team",
      "foreignKey": "ownerId"
    }

The thing is when I use a hasone relationship the api has no "filter" parameter and it doesn't work instead it has a "refresh" parameter.

So if I need to use the api like this via the angular sdk :

User.managedTeam({
          id: uid,
          filter:
          {
            include: ["owner", "members"]
          }
        });

The only way to go is to change the relationship into hasMany to be able to load the team owner and members relations.
Is this really the only way to go?

regards,
Mostafa

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions