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

Support relation of "through model" #13

Open
JonnyBGod opened this issue Dec 2, 2016 · 1 comment
Open

Support relation of "through model" #13

JonnyBGod opened this issue Dec 2, 2016 · 1 comment

Comments

@JonnyBGod
Copy link

Just a placeholder for tracking since it is difficult to track from project.

@MichaelPlaxico
Copy link

MichaelPlaxico commented Oct 25, 2017

@JonnyBGod, @Tallyb, just to be sure, currently, attempting to query a relation with this structure is unsupported? I guess I should also ask--is this package being supported any longer? Seems to have been abandoned.

graphQL

{
  user(id: "59e943fe9c2121128398230b") {
    roles {
      totalCount
      roles {
        id
        name
      }
    }
  } 
}

user.json

...
  "relations": {
    "roles": {
      "type": "hasMany",
      "model": "role",
      "through": "userRole",
      "foreignKey": "userId"
    }
  },

...

role.json

...
  "relations": {
    "users": {
      "type": "hasMany",
      "model": "user",
      "through": "userRole",
      "foreignKey": "roleId"
    }
  },
...

user-role.json

...
  "relations": {
    "roles": {
      "type": "belongsTo",
      "model": "role",
      "foreignKey": "roleId"
    },
    "users": {
      "type": "belongsTo",
      "model": "user",
      "foreignKey": "userId"
    }
  },
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants