diff --git a/CHANGELOG.md b/CHANGELOG.md index 510ccddf6..afc0dcc58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Optimized the asynchronous operations using `Promise.all()` in the info service - Extracted the users from the admin control panel endpoint to a dedicated endpoint - Improved the language localization for Italian (`it`) diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index de4a870d2..acd7b315b 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -54,9 +54,6 @@ export class InfoService { public async get(): Promise { const info: Partial = {}; let isReadOnlyMode: boolean; - const platforms = await this.platformService.getPlatforms({ - orderBy: { name: 'asc' } - }); const globalPermissions: string[] = []; @@ -100,22 +97,30 @@ export class InfoService { globalPermissions.push(permissions.enableSystemMessage); } - const isUserSignupEnabled = - await this.propertyService.isUserSignupEnabled(); + const [ + benchmarks, + demoAuthToken, + isUserSignupEnabled, + platforms, + statistics, + subscriptions, + tags + ] = await Promise.all([ + this.benchmarkService.getBenchmarkAssetProfiles(), + this.getDemoAuthToken(), + this.propertyService.isUserSignupEnabled(), + this.platformService.getPlatforms({ + orderBy: { name: 'asc' } + }), + this.getStatistics(), + this.getSubscriptions(), + this.tagService.get() + ]); if (isUserSignupEnabled) { globalPermissions.push(permissions.createUserAccount); } - const [benchmarks, demoAuthToken, statistics, subscriptions, tags] = - await Promise.all([ - this.benchmarkService.getBenchmarkAssetProfiles(), - this.getDemoAuthToken(), - this.getStatistics(), - this.getSubscriptions(), - this.tagService.get() - ]); - return { ...info, benchmarks,