Feature/optimize admin control panel endpoint using promise.all (#3741)
* Optimize by using Promise.all() * Update changelog
This commit is contained in:
parent
557a0bf808
commit
6db881b08f
@ -10,6 +10,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
|
||||
- Optimized the asynchronous operations using `Promise.all()` in the admin control panel endpoint
|
||||
- Extracted the users from the admin control panel endpoint to a dedicated endpoint
|
||||
- Improved the language localization for Italian (`it`)
|
||||
|
||||
|
@ -108,8 +108,7 @@ export class AdminService {
|
||||
}
|
||||
|
||||
public async get(): Promise<AdminData> {
|
||||
return {
|
||||
exchangeRates: this.exchangeRateDataService
|
||||
const exchangeRates = this.exchangeRateDataService
|
||||
.getCurrencies()
|
||||
.filter((currency) => {
|
||||
return currency !== DEFAULT_CURRENCY;
|
||||
@ -132,10 +131,19 @@ export class AdminService {
|
||||
currency
|
||||
)
|
||||
};
|
||||
}),
|
||||
settings: await this.propertyService.get(),
|
||||
transactionCount: await this.prismaService.order.count(),
|
||||
userCount: await this.prismaService.user.count(),
|
||||
});
|
||||
|
||||
const [settings, transactionCount, userCount] = await Promise.all([
|
||||
this.propertyService.get(),
|
||||
this.prismaService.order.count(),
|
||||
this.prismaService.user.count()
|
||||
]);
|
||||
|
||||
return {
|
||||
exchangeRates,
|
||||
settings,
|
||||
transactionCount,
|
||||
userCount,
|
||||
version: environment.version
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user