title: Is it possible to do a multi tenancy with Graphql and Sequelize?
body: <p>I have a rather tricky question about GraphQl and multi-tenancy.</p>
  <p>Let's assume there are 3 tables, <strong>OWNER</strong>, <strong>HOUSE</strong> and <strong>TENANTS</strong>. I will describe them in Sequelize and GraphQl pseudo code:</p>
  <p>Owner table (has multiple houses and multiple tenants)</p>
  <pre><code>const OWNER = sequelize.define('owner', {
    ownerId: type: Sequelize.INTEGER,
    name: type: Sequelize.STRING
  }
  
  OWNER.associate = models =&gt; {
    models.owner.hasMany(models.house, {foreignKey: {name: 'ownerId', field: 'ownerId'}})
    models.owner.hasMany(models.tenant, {foreignKey: {name: 'ownerId', field: 'ownerId'}})
  }
  </code></pre>
  <p>House table (belongs to owner and has multiple tenants)</p>
  <pre><code>const HOUSE = sequelize.define('house', {
    houseId: type: Sequelize.INTEGER,
    ownerId: type: Sequelize.INTEGER,
    name: type: Sequelize.STRING
  }
  
  HOUSE.associate = models =&gt; {
    models.house.belongsTo(models.owner, {foreignKey: {name: 'ownerId', field: 'ownerId'}})
    models.house.hasMany(models.tenant, {foreignKey: {name: 'houseId', field: 'houseId'}})
  }
  </code></pre>
  <p>Tenant table (belongs to owner and house)</p>
  <pre><code>const TENANT = sequelize.define('tenant', {
    tenantId: type: Sequelize.INTEGER,
    ownerId: type: Sequelize.INTEGER,
    houseId: type: Sequelize.INTEGER,
    name: type: Sequelize.STRING
  }
  
  TENANT.associate = models =&gt; {
    models.tenant.belongsTo(models.owner, {foreignKey: {name: 'ownerId', field: 'ownerId'}})
    models.tenant.belongsTo(models.house, {foreignKey: {name: 'houseId', field: 'houseId'}})
  }
  </code></pre>
  <p>The owner graphql object</p>
  <pre><code>const OwnerType = new GraphQLObjectType({
    name: 'Owner',
    fields: () =&gt; ({
      ownerId: { type: GraphQLInt },
      name: { type: GraphQLString },
      houses: {
        type: GraphQLList(HouseType),
        resolve(owner) {
          return owner.getHouse()
        }
      },
      houseById: {
        type: HouseType,
        args: &lt;args is not defined&gt;
        resolve(owner) {
          return &lt;???&gt;
        }
      },
    })
  })
  </code></pre>
  <p>Here are a few simple GraphQL queries:</p>
  <pre><code>ownerById = {
    type: OwnerType,
    args: {
      ownerId: { type: GraphQLInt },
    },
    resolve(parents, args){
      return models.owner.findOne({ where: args })
    }
  }
  
  houses = {
    type: GraphQLList(HouseType),
    resolve(parents, args){
      return models.house.findAll()
    }
  }
  
  houseById = {
    type: HouseType,
    args: {
      houseId: { type: GraphQLInt },
    },
    resolve(parents, args){
      return models.house.findOne({ where: args })
    }
  }
  
  tenants = {
    type: GraphQLList(TenantType),
    resolve(parents, args){
      return models.tenant.findAll()
    }
  }
  </code></pre>
  <p>These client queries work:</p>
  <pre><code>{
    ownerById(ownerId: 1) {
      ownerId
      name
      house {
        houseId
        name
      }
    }
  }
  
  {
    houseById(houseId: 2) {
      houseId
      name
      tenant {
        tenantId
        name
      }
    }
  }
  </code></pre>
  <p>What I need to make multi-tenancy to work is something like that:</p>
  <pre><code>{
    ownerById(ownerId: 1) {
      ownerId
      name
      houseById(houseId: 2) {
        houseId
        name
        tenant {
          tenantId
          name
        }
      }
    }
  }
  </code></pre>
  <p>Is there a way to archive this or is that out of scope what GraphQl can do?</p>
  <p>If yes, how would the graphql object <code>houseById</code> query look like?</p>
  <p>Thanks in advance.</p>