Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/optimize info endpoint using promise.all (#3742)
Thomas Kaul557a0bf80808
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 510ccddf64..afc0dcc58b 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.tsindex de4a870d28..acd7b315b2 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<InfoItem> {const info: Partial<InfoItem> = {};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,