From c9de8f5a3bcd99c763aea971553ba4b116303e79 Mon Sep 17 00:00:00 2001 From: Niek Candaele Date: Sun, 29 Dec 2024 19:19:36 +0100 Subject: [PATCH] fix: ensure systemconfigschema is included in installation output --- .../__tests__/ModuleController.integration.test.ts | 1 + packages/app-api/src/db/module.ts | 13 ++++++++++--- .../src/__snapshots__/ModuleController/Update.json | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/app-api/src/controllers/__tests__/ModuleController.integration.test.ts b/packages/app-api/src/controllers/__tests__/ModuleController.integration.test.ts index 79343be3f..bfafc35f8 100644 --- a/packages/app-api/src/controllers/__tests__/ModuleController.integration.test.ts +++ b/packages/app-api/src/controllers/__tests__/ModuleController.integration.test.ts @@ -42,6 +42,7 @@ const tests = [ snapshot: true, name: 'Update', setup, + filteredFields: ['moduleId'], test: async function () { return this.client.module.moduleControllerUpdate(this.setupData.id, { name: 'Updated module', diff --git a/packages/app-api/src/db/module.ts b/packages/app-api/src/db/module.ts index 0e6fe8d4d..9b485dcfc 100644 --- a/packages/app-api/src/db/module.ts +++ b/packages/app-api/src/db/module.ts @@ -220,12 +220,16 @@ export class ModuleRepo extends ITakaroRepo({ ...filters, - extend: ['version', 'module'], - }).build(queryInstallations); + }).build(queryInstallations.modify('standardExtend')); return { total: result.total, - results: result.results.map((_) => new ModuleInstallationOutputDTO(_ as unknown as ModuleInstallationOutputDTO)), + results: result.results + .map((_) => new ModuleInstallationOutputDTO(_ as unknown as ModuleInstallationOutputDTO)) + .map((_) => { + _.version.systemConfigSchema = getSystemConfigSchema(_.version as unknown as ModuleVersionOutputDTO); + return _; + }), }; } @@ -434,6 +438,9 @@ export class ModuleRepo extends ITakaroRepo a.permission.localeCompare(b.permission), ); + returnVal.version.systemConfigSchema = getSystemConfigSchema( + returnVal.version as unknown as ModuleVersionOutputDTO, + ); return returnVal; } diff --git a/packages/test/src/__snapshots__/ModuleController/Update.json b/packages/test/src/__snapshots__/ModuleController/Update.json index 43dbcdc73..3dcfb8f34 100644 --- a/packages/test/src/__snapshots__/ModuleController/Update.json +++ b/packages/test/src/__snapshots__/ModuleController/Update.json @@ -39,7 +39,9 @@ "snapshot": true, "name": "Update", "expectedStatus": 200, - "filteredFields": [], + "filteredFields": [ + "moduleId" + ], "standardEnvironment": true } } \ No newline at end of file