@@ -26,8 +26,6 @@ import {
2626 getManyToManyRelation ,
2727 getRelationForeignKeyFieldPairs ,
2828 isEnum ,
29- isInheritedField ,
30- isRelationField ,
3129 isTypeDef ,
3230 getModelFields ,
3331 makeDefaultOrderBy ,
@@ -1141,16 +1139,13 @@ export abstract class BaseCrudDialect<Schema extends SchemaDef> {
11411139 const descendants = getDelegateDescendantModels ( this . schema , model ) ;
11421140 for ( const subModel of descendants ) {
11431141 result = this . buildDelegateJoin ( model , modelAlias , subModel . name , result ) ;
1144- result = result . select ( ( eb ) => {
1142+ result = result . select ( ( ) => {
11451143 const jsonObject : Record < string , Expression < any > > = { } ;
1146- for ( const field of Object . keys ( subModel . fields ) ) {
1147- if (
1148- isRelationField ( this . schema , subModel . name , field ) ||
1149- isInheritedField ( this . schema , subModel . name , field )
1150- ) {
1144+ for ( const fieldDef of getModelFields ( this . schema , subModel . name , { computed : true } ) ) {
1145+ if ( this . shouldOmitField ( omit , subModel . name , fieldDef . name ) ) {
11511146 continue ;
11521147 }
1153- jsonObject [ field ] = eb . ref ( ` ${ subModel . name } . ${ field } ` ) ;
1148+ jsonObject [ fieldDef . name ] = this . fieldRef ( subModel . name , fieldDef . name , subModel . name ) ;
11541149 }
11551150 return this . buildJsonObject ( jsonObject ) . as ( `${ DELEGATE_JOINED_FIELD_PREFIX } ${ subModel . name } ` ) ;
11561151 } ) ;
0 commit comments