diff --git a/src/entity/ComponentRelation.ts b/src/entity/ComponentRelation.ts index 76540f93362ab7011f5f851d8e1ea265b66a65df..f788d382724b05eb38d352646ac244416f099332 100644 --- a/src/entity/ComponentRelation.ts +++ b/src/entity/ComponentRelation.ts @@ -68,7 +68,9 @@ export default class ComponentRelation { } static findById(id: string, repository: Repository<ComponentRelation>): Promise<ComponentRelation | undefined> { - return repository.findOne(id); + return repository.findOne(id, { + relations: ["parent", "child"] + }); } static findParentRelation(component: Component, repository: Repository<ComponentRelation>): Promise<ComponentRelation | undefined> { @@ -93,11 +95,11 @@ export default class ComponentRelation { }; if(this.parent) { - document["parent"] = { "@id": `${config.baseURL}/relation/${this.parent.id.toString()}`}; + document["parent"] = { "@id": `${config.baseURL}/component/${this.parent.id.toString()}`}; } if(this.child) { - document["child"] = { "@id": `${config.baseURL}/relation/${this.child.id.toString()}`}; + document["child"] = { "@id": `${config.baseURL}/component/${this.child.id.toString()}`}; } if(this.to) { diff --git a/src/util/ContextDefinitions.ts b/src/util/ContextDefinitions.ts index 1367eb08a0d43daca403313714e1fe5f88cdd652..2ac6d204938e7ddb1133e5afc2deab3038882eb2 100644 --- a/src/util/ContextDefinitions.ts +++ b/src/util/ContextDefinitions.ts @@ -10,7 +10,9 @@ const componentRelation = { "id": { "@id": "https://schema.org/url", "@type": "@id"}, "from": "https://schema.org/DateTime", "to": "https://schema.org/DateTime", - "license": "https://www.w3.org/1999/xhtml/vocab#license" + "license": "https://www.w3.org/1999/xhtml/vocab#license", + "parent": { "@id": "https://schema.org/url", "@type": "@id"}, + "child": { "@id": "https://schema.org/url", "@type": "@id"} }; const information = function(metadataContext: unknown, previousVersion: ComponentInformation | undefined, nextVersion: ComponentInformation | undefined): Record<string, unknown> {