From d588a93b0dd5b270199083cfb0856e34b57afa66 Mon Sep 17 00:00:00 2001 From: Thomas Mauran <78204354+thomas-mauran@users.noreply.github.com> Date: Mon, 18 Nov 2024 11:09:36 +0100 Subject: [PATCH] fix: getAsset should search in commons assets too (#380) --- lib/modules/model/ModelService.ts | 7 ++++++- tests/scenario/modules/models/asset-model.test.ts | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/modules/model/ModelService.ts b/lib/modules/model/ModelService.ts index d5dc9800..92788c1d 100644 --- a/lib/modules/model/ModelService.ts +++ b/lib/modules/model/ModelService.ts @@ -572,7 +572,12 @@ export class ModelService extends BaseService { ): Promise> { const query = { and: [ - { equals: { engineGroup } }, + { + or: [ + { equals: { engineGroup } }, + { equals: { engineGroup: "commons" } }, + ], + }, { equals: { type: "asset" } }, { equals: { "asset.model": model } }, ], diff --git a/tests/scenario/modules/models/asset-model.test.ts b/tests/scenario/modules/models/asset-model.test.ts index 38d47885..7d475397 100644 --- a/tests/scenario/modules/models/asset-model.test.ts +++ b/tests/scenario/modules/models/asset-model.test.ts @@ -111,15 +111,6 @@ describe("ModelsController:assets", () => { _id: "model-asset-Plane", _source: { asset: { model: "Plane" } }, }); - - const getAssetNotExist = sdk.query({ - controller: "device-manager/models", - action: "getAsset", - engineGroup: "other_engine", - model: "Plane", - }); - - await expect(getAssetNotExist).rejects.toMatchObject({ status: 404 }); }); it("List asset models only from the requested engine group and the common ones", async () => {