Skip to content

Commit

Permalink
chore: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbi08 committed Dec 4, 2024
1 parent 405d20f commit 49b89d5
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,6 @@ export class AttributesController extends ConsumptionBaseController {

public async getAttributeTagCollection(): Promise<AttributeTagCollection> {
const backboneAttributeTagCollection = (await this.attributeTagClient.getBackboneAttributeTagCollection()).value;
return AttributeTagCollection.fromAny(backboneAttributeTagCollection);
return AttributeTagCollection.from(backboneAttributeTagCollection);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import { Serializable, serialize, type, validate } from "@js-soft/ts-serval";

export interface IAttributeTagCollection {
supportedLanguages: string[];
tagsForAttributeValueTypes: Record<string, Record<string, IAttributeTag>>;
}

export interface IAttributeTag {
displayNames: Record<string, string>;
children?: Record<string, IAttributeTag>;
}

@type("AttributeTagCollection")
export class AttributeTagCollection extends Serializable {
export class AttributeTagCollection extends Serializable implements IAttributeTagCollection {
@serialize({ type: String })
@validate()
public supportedLanguages: string[];

@serialize()
@validate()
public tagsForAttributeValueTypes: Record<string, Record<string, AttributeTag>>;

public static from(value: IAttributeTagCollection): AttributeTagCollection {
return this.fromAny(value);
}
}

@type("AttributeTag")
export class AttributeTag extends Serializable {
export class AttributeTag extends Serializable implements IAttributeTag {
@serialize()
@validate()
public displayNames: Record<string, string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class GetAttributeTagCollectionUseCase extends UseCase<void, AttributeTag
}

protected async executeInternal(): Promise<Result<AttributeTagCollectionDTO>> {
const tagList = await this.attributesController.getAttributeTagCollection();
return Result.ok(AttributeTagCollectionMapper.toAttributeTagCollectionDTO(tagList));
const attributeTagCollection = await this.attributesController.getAttributeTagCollection();
return Result.ok(AttributeTagCollectionMapper.toAttributeTagCollectionDTO(attributeTagCollection));
}
}
4 changes: 2 additions & 2 deletions packages/transport/src/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export * from "./sync/DatawalletModificationsProcessor";
export * from "./sync/local/DatawalletModification";
export * from "./sync/SyncController";
export * from "./sync/SynchronizedCollection";
export * from "./tags/backbone/BackboneGetTag";
export * from "./tags/backbone/TagClient";
export * from "./tags/backbone/AttributeTagClient";
export * from "./tags/backbone/BackboneGetAttributeTagCollection";
export * from "./tokens/AnonymousTokenController";
export * from "./tokens/backbone/BackboneGetTokens";
export * from "./tokens/backbone/BackbonePostTokens";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ClientResult } from "../../../core/backbone/ClientResult";
import { RESTClientAuthenticate } from "../../../core/backbone/RESTClientAuthenticate";
import { BackboneAttributeTagCollection } from "./BackboneGetTag";
import { BackboneGetAttributeTagCollection } from "./BackboneGetAttributeTagCollection";

export class AttributeTagClient extends RESTClientAuthenticate {
public async getBackboneAttributeTagCollection(): Promise<ClientResult<BackboneAttributeTagCollection>> {
return await this.get<BackboneAttributeTagCollection>("/api/v1/Tags");
public async getBackboneAttributeTagCollection(): Promise<ClientResult<BackboneGetAttributeTagCollection>> {
return await this.get<BackboneGetAttributeTagCollection>("/api/v1/Tags");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface BackboneGetAttributeTagCollection {
supportedLanguages: string[];
tagsForAttributeValueTypes: Record<string, Record<string, BackboneGetAttributeTag>>;
}

interface BackboneGetAttributeTag {
displayNames: Record<string, string>;
children?: Record<string, BackboneGetAttributeTag>;
}

This file was deleted.

0 comments on commit 49b89d5

Please sign in to comment.