|
|
@ -1206,7 +1206,12 @@ class BaseModelSql extends BaseModel { |
|
|
|
* @param {String} [args.sort] - comma separated column names where each column name is cn ascending and -cn is cn descending |
|
|
|
* @param {String} [args.sort] - comma separated column names where each column name is cn ascending and -cn is cn descending |
|
|
|
* @returns {Promise<Object[]>} return child rows |
|
|
|
* @returns {Promise<Object[]>} return child rows |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async hasManyChildren({child, parentId, conditionGraph = null, ...args}: XcFilterWithAlias & { child: string, parentId: any }) { |
|
|
|
async hasManyChildren({ |
|
|
|
|
|
|
|
child, |
|
|
|
|
|
|
|
parentId, |
|
|
|
|
|
|
|
conditionGraph = null, |
|
|
|
|
|
|
|
...args |
|
|
|
|
|
|
|
}: XcFilterWithAlias & { child: string, parentId: any }) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const {where, limit, offset, sort, ...restArgs} = this._getListArgs(args); |
|
|
|
const {where, limit, offset, sort, ...restArgs} = this._getListArgs(args); |
|
|
|
let {fields} = restArgs; |
|
|
|
let {fields} = restArgs; |
|
|
@ -1296,7 +1301,7 @@ class BaseModelSql extends BaseModel { |
|
|
|
let fields = fields1 || f || '*'; |
|
|
|
let fields = fields1 || f || '*'; |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
if (fields !== '*' && fields.split(',').indexOf(this.pks[0].cn) === -1) { |
|
|
|
if (fields !== '*' && this.pks[0] && fields.split(',').indexOf(this.pks?.[0]?.cn) === -1) { |
|
|
|
fields += ',' + this.pks[0].cn; |
|
|
|
fields += ',' + this.pks[0].cn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1349,7 +1354,7 @@ class BaseModelSql extends BaseModel { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
// todo: use fields in readbyPk
|
|
|
|
// todo: use fields in readbyPk
|
|
|
|
if (fields !== '*' && fields.split(',').indexOf(this.pks[0].cn) === -1) { |
|
|
|
if (fields !== '*' && this.pks[0] && fields.split(',').indexOf(this.pks[0].cn) === -1) { |
|
|
|
fields += ',' + this.pks[0].cn; |
|
|
|
fields += ',' + this.pks[0].cn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|