File tree 1 file changed +3
-2
lines changed
libs/json-api-nestjs/src/lib/mixin/service/transform
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,9 @@ export class TransformMixinService<T> {
141
141
val
142
142
) ;
143
143
if ( Array . isArray ( acum [ key ] ) ) {
144
- acum [ key ] . push ( plainObject ) ;
144
+ if ( plainObject [ this . relationPrimaryField . get ( key ) ] !== null ) {
145
+ acum [ key ] . push ( plainObject ) ;
146
+ }
145
147
} else {
146
148
acum [ key ] = plainObject ;
147
149
}
@@ -181,7 +183,6 @@ export class TransformMixinService<T> {
181
183
const propsData = data [ field ] ;
182
184
const typeName = getEntityName ( this . relationTarget . get ( field ) ) ;
183
185
if ( Array . isArray ( propsData ) ) {
184
- console . log ( propsData , this . relationPrimaryField . get ( field ) ) ;
185
186
builtData . data = propsData . map ( ( i ) => ( {
186
187
type : camelToKebab ( typeName ) ,
187
188
id : i [ this . relationPrimaryField . get ( field ) ] . toString ( ) ,
You can’t perform that action at this time.
0 commit comments