Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KZLPRD-677: add group ids soft tenant to asset measure #383

Draft
wants to merge 1 commit into
base: 2-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/modules/asset/AssetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export class AssetService extends DigitalTwinService {
metadata: { ...assetMetadata, ...metadata },
model,
reference,
softTenant: [],
},
},
{
Expand Down
1 change: 1 addition & 0 deletions lib/modules/asset/model/AssetSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class AssetSerializer {
metadata: asset._source.metadata,
model: asset._source.model,
reference: asset._source.reference,
softTenant: asset._source.softTenant,
};
}
}
6 changes: 5 additions & 1 deletion lib/modules/asset/types/AssetContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export interface AssetContent<
id: string;
date: number;
}>;
/**
* Id's of soft tenants
*/
softTenant: Array<string>;
}

/**
Expand All @@ -55,5 +59,5 @@ export type AssetMeasureContext<TMetadata extends Metadata = Metadata> = {
measureName: string;
} & Pick<
AssetContent<JSONObject, TMetadata>,
"model" | "reference" | "metadata" | "groups"
"model" | "reference" | "metadata" | "groups" | "softTenant"
>;
1 change: 1 addition & 0 deletions lib/modules/measure/collections/measuresMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const measuresMappings = {
date: { type: "date" },
},
},
softTenant: { type: "keyword" },
},
},

Expand Down
3 changes: 2 additions & 1 deletion tests/application/assets/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ function neverCalled() {
reference: "",
metadata: undefined,
measures,
lastMeasuredAt: 0
lastMeasuredAt: 0,
softTenant: [],
};

container.metadata.height = 40;
Expand Down
2 changes: 2 additions & 0 deletions tests/application/tests/pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function registerTestPipes(app: Backend) {
metadata: asset._source.metadata,
model: asset._source.model,
reference: asset._source.reference,
softTenant: asset._source.softTenant,
},
measuredAt: measure.measuredAt,
origin: {
Expand Down Expand Up @@ -111,6 +112,7 @@ export function registerTestPipes(app: Backend) {
metadata: asset._source.metadata,
model: asset._source.model,
reference: asset._source.reference,
softTenant: asset._source.softTenant,
},
origin: {
type: "computed",
Expand Down