diff --git a/API.paw b/API.paw index 2d3ca1276dd1269f090933f967d23a08ac493761..6bc24f9a7751b90ab7d17c10d9b19df1915f184a 100644 Binary files a/API.paw and b/API.paw differ diff --git a/src/entity/Component.ts b/src/entity/Component.ts index 680465555d1a86eb5eb6f2af18b72d9d076a0f0a..5a6bbb508a1d9f276fc38755173105e4c13b53cd 100644 --- a/src/entity/Component.ts +++ b/src/entity/Component.ts @@ -95,6 +95,7 @@ export default class Component { .leftJoinAndSelect("isComponentOf.child", "isComponentOfChild") .leftJoinAndSelect("isComponentOf.parent", "isComponentOfParent") .leftJoinAndSelect("information.type", "type") + .leftJoinAndSelect("component.isTargetOfInformation", "isTargetOfInformation") .where("component.id != :rootIdFilter AND component.dateCreated <= :dateCreated::timestamptz AND parent.parent = :parentIsRootFilter", { rootIdFilter: Component.rootId, dateCreated: date, @@ -113,6 +114,7 @@ export default class Component { .leftJoinAndSelect("isComponentOf.parent", "isComponentOfParent", "isComponentOf.parent != :rootId", { rootId: Component.rootId }) .leftJoinAndSelect("isComponentOf.child", "isComponentOfChild") .leftJoinAndSelect("component.information", "information") + .leftJoinAndSelect("component.isTargetOfInformation", "isTargetOfInformation") .leftJoinAndSelect("information.type", "type"); if(filter != null && filter.length > 0) { @@ -152,6 +154,7 @@ export default class Component { .leftJoinAndSelect("isComponentOf.parent", "isComponentOfParent", "isComponentOf.parent != :rootId", { rootId: Component.rootId }) .leftJoinAndSelect("isComponentOf.child", "isComponentOfChild") .leftJoinAndSelect("component.information", "information") + .leftJoinAndSelect("component.isTargetOfInformation", "isTargetOfInformation") .leftJoinAndSelect("information.type", "type") .where("component.id = :id AND component.dateCreated <= :date::timestamptz", { id, date }) .getOne(); @@ -194,7 +197,7 @@ export default class Component { }; if (this.isComponentOf) { - const relationJSONLD: Record<string, unknown>[] = this.isComponentOf.map((relation) => { return relation.toJSONLD(); }); + const relationJSONLD: Record<string, unknown>[] = this.isComponentOf.map((relation) => { return { "@id": `${config.baseURL}/relation/${relation.id.toString()}` }; }); if (relationJSONLD.length == 1) { document.isComponentOf = relationJSONLD[0]; } else { @@ -203,11 +206,15 @@ export default class Component { } if (this.subComponents) { - document.subComponents = this.subComponents.map((relation) => { return relation.toJSONLD(); }); + document.subComponents = this.subComponents.map((relation) => { return { "@id": `${config.baseURL}/relation/${relation.id.toString()}` }; }); } if (this.information) { - document.information = this.information.map((information) => { return information.toJSONLD(); }); + document.information = this.information.map((information) => { return { "@id": `${config.baseURL}/information/${information.id.toString()}` }; }); + } + + if (this.isTargetOfInformation) { + document.isTargetOfInformation = this.isTargetOfInformation.map((information) => { return { "@id": `${config.baseURL}/information/${information.id.toString()}` }; }); } return document;