Browse Source

Feature/extend admin endpoint by asset profile count per data provider (#4676)

* Extend admin endpoint by asset profile count per data provider

* Update changelog
pull/4682/head
Felix Jordan 2 months ago
committed by GitHub
parent
commit
aadd9f56a0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      CHANGELOG.md
  2. 25
      apps/api/src/app/admin/admin.service.ts
  3. 2
      libs/common/src/lib/interfaces/admin-data.interface.ts

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Added the asset profile count per data provider to the endpoint `GET api/v1/admin`
### Changed
- Improved the language localization for Catalan (`ca`)

25
apps/api/src/app/admin/admin.service.ts

@ -143,15 +143,30 @@ export class AdminService {
this.countUsersWithAnalytics()
]);
const dataProviders = await Promise.all(
dataSources.map(async (dataSource) => {
const dataProviderInfo = this.dataProviderService
.getDataProvider(dataSource)
.getDataProviderInfo();
const assetProfileCount = await this.prismaService.symbolProfile.count({
where: {
dataSource
}
});
return {
...dataProviderInfo,
assetProfileCount
};
})
);
return {
dataProviders,
settings,
transactionCount,
userCount,
dataProviders: dataSources.map((dataSource) => {
return this.dataProviderService
.getDataProvider(dataSource)
.getDataProviderInfo();
}),
version: environment.version
};
}

2
libs/common/src/lib/interfaces/admin-data.interface.ts

@ -1,7 +1,7 @@
import { DataProviderInfo } from './data-provider-info.interface';
export interface AdminData {
dataProviders: DataProviderInfo[];
dataProviders: (DataProviderInfo & { assetProfileCount: number })[];
settings: { [key: string]: boolean | object | string | string[] };
transactionCount: number;
userCount: number;

Loading…
Cancel
Save