Skip to content

Commit

Permalink
Provide backbone-defined public RelationshipTemplate references (#336)
Browse files Browse the repository at this point in the history
* feat: add public relationship references POC

* chore: nomenclature

* chore: update index

* chore: update schema

* chore: typo

* chore: pr comments

* chore: pr comments

* chore: use barrels

* test: add tests for new backbone version

* test: add rest client mock

* chore: add missing file

* chore: fix eslint

* chore: fix eslint

* chore: test naming

* chore: use standard mock strings

* Update packages/runtime/src/useCases/transport/publicRelationshipTemplateReferences/PublicRelationshipTemplateReferenceMapper.ts

Co-authored-by: Julian König <[email protected]>

* chore: switch to mockito

* chore: remove unused file

* Update packages/transport/test/modules/publicRelationshipTemplateReferences/PublicRelationshipTemplateReferencesController.test.ts

Co-authored-by: Milena Czierlinski <[email protected]>

* chore: simpler naming

* chore: simplify / order tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Julian König <[email protected]>
Co-authored-by: Milena Czierlinski <[email protected]>
Co-authored-by: Julian König <[email protected]>
  • Loading branch information
5 people authored Nov 28, 2024
1 parent 226d09b commit 4abbafe
Show file tree
Hide file tree
Showing 21 changed files with 612 additions and 374 deletions.
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@nmshd/crypto": "2.1.0",
"@nmshd/iql": "^1.0.2",
"@nmshd/transport": "*",
"@nmshd/typescript-ioc": "3.2.4",
"ajv": "^8.17.1",
"ajv-errors": "^3.0.0",
"ajv-formats": "^3.0.1",
Expand All @@ -78,8 +79,7 @@
"luxon": "^3.5.0",
"qrcode": "1.5.4",
"reflect-metadata": "^0.2.2",
"ts-simple-nameof": "^1.3.1",
"@nmshd/typescript-ioc": "3.2.4"
"ts-simple-nameof": "^1.3.1"
},
"devDependencies": {
"@js-soft/docdb-access-loki": "1.1.0",
Expand All @@ -89,7 +89,8 @@
"@types/lodash": "^4.17.13",
"@types/luxon": "^3.4.2",
"@types/qrcode": "^1.5.5",
"ts-json-schema-generator": "2.3.0"
"ts-json-schema-generator": "2.3.0",
"ts-mockito": "^2.6.1"
},
"publishConfig": {
"access": "public",
Expand Down
5 changes: 5 additions & 0 deletions packages/runtime/src/Runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
IdentityController,
IdentityDeletionProcessController,
MessageController,
PublicRelationshipTemplateReferencesController,
RelationshipsController,
RelationshipTemplateController,
TokenController,
Expand Down Expand Up @@ -258,6 +259,10 @@ export abstract class Runtime<TConfig extends RuntimeConfig = RuntimeConfig> {
.factory(() => this.getAccountController().tokens)
.scope(Scope.Request);

Container.bind(PublicRelationshipTemplateReferencesController)
.factory(() => this.getAccountController().publicRelationshipTemplateReferences)
.scope(Scope.Request);

Container.bind(ChallengeController)
.factory(() => this.getAccountController().challenges)
.scope(Scope.Request);
Expand Down
4 changes: 3 additions & 1 deletion packages/runtime/src/extensibility/TransportServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
FilesFacade,
IdentityDeletionProcessesFacade,
MessagesFacade,
PublicRelationshipTemplateReferencesFacade,
RelationshipsFacade,
RelationshipTemplatesFacade,
TokensFacade
Expand All @@ -21,6 +22,7 @@ export class TransportServices {
@Inject public readonly account: AccountFacade,
@Inject public readonly devices: DevicesFacade,
@Inject public readonly challenges: ChallengesFacade,
@Inject public readonly identityDeletionProcesses: IdentityDeletionProcessesFacade
@Inject public readonly identityDeletionProcesses: IdentityDeletionProcessesFacade,
@Inject public readonly publicRelationshipTemplateReferences: PublicRelationshipTemplateReferencesFacade
) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Result } from "@js-soft/ts-utils";
import { Inject } from "@nmshd/typescript-ioc";
import { PublicRelationshipTemplateReferenceDTO } from "../../../types";
import { GetPublicRelationshipTemplateReferencesUseCase } from "../../../useCases";

export class PublicRelationshipTemplateReferencesFacade {
public constructor(@Inject private readonly getPublicRelationshipTemplateReferencesUseCase: GetPublicRelationshipTemplateReferencesUseCase) {}

public async getPublicRelationshipTemplateReferences(): Promise<Result<PublicRelationshipTemplateReferenceDTO[]>> {
return await this.getPublicRelationshipTemplateReferencesUseCase.execute();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./DevicesFacade";
export * from "./FilesFacade";
export * from "./IdentityDeletionProcessesFacade";
export * from "./MessagesFacade";
export * from "./RelationshipTemplatesFacade";
export * from "./PublicRelationshipTemplateReferencesFacade";
export * from "./RelationshipsFacade";
export * from "./RelationshipTemplatesFacade";
export * from "./TokensFacade";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface PublicRelationshipTemplateReferenceDTO {
title: string;
description: string;
truncatedReference: string;
}
3 changes: 2 additions & 1 deletion packages/runtime/src/types/transport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ export * from "./ChallengeDTO";
export * from "./DeviceDTO";
export * from "./DeviceOnboardingInfoDTO";
export * from "./FileDTO";
export * from "./IdentityDTO";
export * from "./IdentityDeletionProcessDTO";
export * from "./IdentityDTO";
export * from "./MessageDTO";
export * from "./MessageWithAttachmentsDTO";
export * from "./PublicRelationshipTemplateReferenceDTO";
export * from "./RecipientDTO";
export * from "./RelationshipDTO";
export * from "./RelationshipTemplateDTO";
Expand Down
Loading

0 comments on commit 4abbafe

Please sign in to comment.