Browse Source

fix: graphql nested list bug

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/642/head
Pranav C 3 years ago
parent
commit
0898a3e070
  1. 4
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts
  2. 4
      packages/nocodb/tests/mysql-sakila-db/02-mysql-sakila-insert-data.sql

4
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts

@ -2054,10 +2054,10 @@ class BaseModelSql extends BaseModel {
this.dbDriver.unionAll( this.dbDriver.unionAll(
ids.map(p => { ids.map(p => {
const query = this.dbDriver(this.dbModels[child].tnPath) const query = this.dbDriver(this.dbModels[child].tnPath)
.count(`${cn} as count`)
.where({ [cn]: p }) .where({ [cn]: p })
.xwhere(where, this.selectQuery('')) .xwhere(where, this.selectQuery(''))
.conditionGraph(conditionGraph) .conditionGraph(conditionGraph)
.count(`${cn} as count`)
.first(); .first();
return this.isSqlite() ? this.dbDriver.select().from(query) : query; return this.isSqlite() ? this.dbDriver.select().from(query) : query;
}), }),
@ -2212,6 +2212,8 @@ class BaseModelSql extends BaseModel {
!fields || !fields ||
fieldsArr.includes('*') || fieldsArr.includes('*') ||
fieldsArr.includes(`${this.tn}.*`) || fieldsArr.includes(`${this.tn}.*`) ||
fieldsArr.includes(`${this.tn}.${col._cn}`) ||
fieldsArr.includes(`${this.tn}.${col.cn}`) ||
fieldsArr.includes(col._cn) || fieldsArr.includes(col._cn) ||
fieldsArr.includes(col.cn) fieldsArr.includes(col.cn)
) { ) {

4
packages/nocodb/tests/mysql-sakila-db/02-mysql-sakila-insert-data.sql

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save