Skip to content

Commit a87b23d

Browse files
fix(content): fix optional relation array
1 parent 2fd0e9d commit a87b23d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

microservices/content/src/repositories/single-type.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SingleType extends Repository<SingleTypeEntity> {
4949
}
5050

5151
if (hasMany) {
52-
return (value = this.replaceRelationIdsOnEntities(data, value, property));
52+
return (value = this.replaceRelationIdsOnEntities(data, value, property)!);
5353
}
5454

5555
value[property] = data;
@@ -63,17 +63,14 @@ class SingleType extends Repository<SingleTypeEntity> {
6363
data: unknown[],
6464
value: ISingleTypeValue,
6565
property: string,
66-
): ISingleTypeValue {
66+
): ISingleTypeValue | void {
6767
if (!Array.isArray(value)) {
6868
return value;
6969
}
7070

71-
return value.map((input) => {
71+
value.forEach((input) => {
7272
if (!input.hasOwnProperty(property)) {
73-
throw new BaseException({
74-
status: 500,
75-
message: `Invalid object format. "${property}" property does not exist in "value" objects.`,
76-
});
73+
return;
7774
}
7875

7976
input[property] = replaceEntities(

0 commit comments

Comments
 (0)