Skip to content

Commit 6822aa5

Browse files
author
Alexander Kharkovey
committed
fix(json-api-nestjs): forgot check if object not exist
1 parent 823b868 commit 6822aa5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libs/json-api-nestjs/src/lib/mixin/service/transform/transform.mixin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ export class TransformMixinService<T> {
145145
acum[key].push(plainObject);
146146
}
147147
} else {
148-
acum[key] = plainObject;
148+
acum[key] =
149+
plainObject[this.relationPrimaryField.get(key)] === null
150+
? undefined
151+
: plainObject;
149152
}
150153
return acum;
151154
}, dataJson[currentId]),

0 commit comments

Comments
 (0)