Skip to content

Commit

Permalink
fix: getAsset should search in commons assets too (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-mauran authored Nov 18, 2024
1 parent be8cfc4 commit d588a93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
7 changes: 6 additions & 1 deletion lib/modules/model/ModelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,12 @@ export class ModelService extends BaseService {
): Promise<KDocument<AssetModelContent>> {
const query = {
and: [
{ equals: { engineGroup } },
{
or: [
{ equals: { engineGroup } },
{ equals: { engineGroup: "commons" } },
],
},
{ equals: { type: "asset" } },
{ equals: { "asset.model": model } },
],
Expand Down
9 changes: 0 additions & 9 deletions tests/scenario/modules/models/asset-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit d588a93

Please sign in to comment.