Browse Source

Task/deprecate transactionCount in GET api/v1/admin endpoint (#6265)

* Deprecate transactionCount in favor of activitiesCount

* Update changelog
pull/6266/head^2
Thomas Kaul 3 days ago
committed by GitHub
parent
commit
eae2c20dfe
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 7
      apps/api/src/app/admin/admin.service.ts
  3. 6
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  4. 6
      apps/client/src/app/components/admin-overview/admin-overview.html
  5. 4
      libs/common/src/lib/interfaces/admin-data.interface.ts

1
CHANGELOG.md

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Deprecated `transactionCount` in favor of `activitiesCount` in the endpoint `GET api/v1/admin`
- Removed the deprecated `firstBuyDate` in the portfolio calculator - Removed the deprecated `firstBuyDate` in the portfolio calculator
## 2.234.0 - 2026-01-30 ## 2.234.0 - 2026-01-30

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

@ -138,11 +138,11 @@ export class AdminService {
public async get(): Promise<AdminData> { public async get(): Promise<AdminData> {
const dataSources = Object.values(DataSource); const dataSources = Object.values(DataSource);
const [enabledDataSources, settings, transactionCount, userCount] = const [activitiesCount, enabledDataSources, settings, userCount] =
await Promise.all([ await Promise.all([
this.prismaService.order.count(),
this.dataProviderService.getDataSources(), this.dataProviderService.getDataSources(),
this.propertyService.get(), this.propertyService.get(),
this.prismaService.order.count(),
this.countUsersWithAnalytics() this.countUsersWithAnalytics()
]); ]);
@ -182,10 +182,11 @@ export class AdminService {
).filter(Boolean); ).filter(Boolean);
return { return {
activitiesCount,
dataProviders, dataProviders,
settings, settings,
transactionCount,
userCount, userCount,
transactionCount: activitiesCount,
version: environment.version version: environment.version
}; };
} }

6
apps/client/src/app/components/admin-overview/admin-overview.component.ts

@ -73,6 +73,7 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './admin-overview.html' templateUrl: './admin-overview.html'
}) })
export class GfAdminOverviewComponent implements OnDestroy, OnInit { export class GfAdminOverviewComponent implements OnDestroy, OnInit {
public activitiesCount: number;
public couponDuration: StringValue = '14 days'; public couponDuration: StringValue = '14 days';
public coupons: Coupon[]; public coupons: Coupon[];
public hasPermissionForSubscription: boolean; public hasPermissionForSubscription: boolean;
@ -83,7 +84,6 @@ export class GfAdminOverviewComponent implements OnDestroy, OnInit {
public isDataGatheringEnabled: boolean; public isDataGatheringEnabled: boolean;
public permissions = permissions; public permissions = permissions;
public systemMessage: SystemMessage; public systemMessage: SystemMessage;
public transactionCount: number;
public userCount: number; public userCount: number;
public user: User; public user: User;
public version: string; public version: string;
@ -289,12 +289,12 @@ export class GfAdminOverviewComponent implements OnDestroy, OnInit {
this.adminService this.adminService
.fetchAdminData() .fetchAdminData()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ settings, transactionCount, userCount, version }) => { .subscribe(({ activitiesCount, settings, userCount, version }) => {
this.activitiesCount = activitiesCount;
this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? []; this.coupons = (settings[PROPERTY_COUPONS] as Coupon[]) ?? [];
this.isDataGatheringEnabled = this.isDataGatheringEnabled =
settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true; settings[PROPERTY_IS_DATA_GATHERING_ENABLED] === false ? false : true;
this.systemMessage = settings[PROPERTY_SYSTEM_MESSAGE] as SystemMessage; this.systemMessage = settings[PROPERTY_SYSTEM_MESSAGE] as SystemMessage;
this.transactionCount = transactionCount;
this.userCount = userCount; this.userCount = userCount;
this.version = version; this.version = version;

6
apps/client/src/app/components/admin-overview/admin-overview.html

@ -20,11 +20,11 @@
<div class="w-50"> <div class="w-50">
<gf-value <gf-value
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[value]="transactionCount" [value]="activitiesCount"
/> />
@if (transactionCount && userCount) { @if (activitiesCount && userCount) {
<div> <div>
{{ transactionCount / userCount | number: '1.2-2' }} {{ activitiesCount / userCount | number: '1.2-2' }}
<span i18n>per User</span> <span i18n>per User</span>
</div> </div>
} }

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

@ -1,12 +1,16 @@
import { DataProviderInfo } from './data-provider-info.interface'; import { DataProviderInfo } from './data-provider-info.interface';
export interface AdminData { export interface AdminData {
activitiesCount: number;
dataProviders: (DataProviderInfo & { dataProviders: (DataProviderInfo & {
assetProfileCount: number; assetProfileCount: number;
useForExchangeRates: boolean; useForExchangeRates: boolean;
})[]; })[];
settings: { [key: string]: boolean | object | string | string[] }; settings: { [key: string]: boolean | object | string | string[] };
/** @deprecated use activitiesCount instead */
transactionCount: number; transactionCount: number;
userCount: number; userCount: number;
version: string; version: string;
} }

Loading…
Cancel
Save