Feature/optimize info endpoint using promise.all (#3742)
* Optimize by using Promise.all() * Update changelog
This commit is contained in:
parent
bdb3a8f1dc
commit
557a0bf808
@ -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`)
|
||||
|
||||
|
@ -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();
|
||||
|
||||
if (isUserSignupEnabled) {
|
||||
globalPermissions.push(permissions.createUserAccount);
|
||||
}
|
||||
|
||||
const [benchmarks, demoAuthToken, statistics, subscriptions, tags] =
|
||||
await Promise.all([
|
||||
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);
|
||||
}
|
||||
|
||||
return {
|
||||
...info,
|
||||
benchmarks,
|
||||
|
Loading…
x
Reference in New Issue
Block a user