Skip to content

Commit

Permalink
fix: ensure systemconfigschema is included in installation output
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele committed Dec 29, 2024
1 parent b03529d commit c9de8f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 10 additions & 3 deletions packages/app-api/src/db/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,16 @@ export class ModuleRepo extends ITakaroRepo<ModuleModel, ModuleOutputDTO, Module

const result = await new QueryBuilder<ModuleInstallationModel, ModuleInstallationOutputDTO>({
...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 _;
}),
};
}

Expand Down Expand Up @@ -434,6 +438,9 @@ export class ModuleRepo extends ITakaroRepo<ModuleModel, ModuleOutputDTO, Module
returnVal.version.permissions = returnVal.version.permissions.sort((a, b) =>
a.permission.localeCompare(b.permission),
);
returnVal.version.systemConfigSchema = getSystemConfigSchema(
returnVal.version as unknown as ModuleVersionOutputDTO,
);

return returnVal;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/test/src/__snapshots__/ModuleController/Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"snapshot": true,
"name": "Update",
"expectedStatus": 200,
"filteredFields": [],
"filteredFields": [
"moduleId"
],
"standardEnvironment": true
}
}

0 comments on commit c9de8f5

Please sign in to comment.