Browse Source

Merge remote-tracking branch 'origin/main' into task/migrate-login-dialog-to-form-control

pull/5390/head
KenTandrian 16 hours ago
parent
commit
8b18b0b2f2
  1. 4
      CHANGELOG.md
  2. 2
      apps/api/src/app/admin/admin.controller.ts
  3. 46
      apps/api/src/app/admin/admin.service.ts
  4. 11
      libs/common/src/lib/personal-finance-tools.ts

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## Unreleased
### Added
- Extended the data providers management of the admin control panel by every data provider in use
### Changed ### Changed
- Migrated the login with access token dialog from `ngModel` to form control - Migrated the login with access token dialog from `ngModel` to form control

2
apps/api/src/app/admin/admin.controller.ts

@ -66,7 +66,7 @@ export class AdminController {
@HasPermission(permissions.accessAdminControl) @HasPermission(permissions.accessAdminControl)
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) @UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async getAdminData(): Promise<AdminData> { public async getAdminData(): Promise<AdminData> {
return this.adminService.get({ user: this.request.user }); return this.adminService.get();
} }
@Get('demo-user/sync') @Get('demo-user/sync')

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

@ -29,7 +29,7 @@ import {
Filter Filter
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { Sector } from '@ghostfolio/common/interfaces/sector.interface'; import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
import { MarketDataPreset, UserWithSettings } from '@ghostfolio/common/types'; import { MarketDataPreset } from '@ghostfolio/common/types';
import { import {
BadRequestException, BadRequestException,
@ -133,11 +133,8 @@ export class AdminService {
} }
} }
public async get({ user }: { user: UserWithSettings }): Promise<AdminData> { public async get(): Promise<AdminData> {
const dataSources = await this.dataProviderService.getDataSources({ const dataSources = Object.values(DataSource);
user,
includeGhostfolio: true
});
const [settings, transactionCount, userCount] = await Promise.all([ const [settings, transactionCount, userCount] = await Promise.all([
this.propertyService.get(), this.propertyService.get(),
@ -145,24 +142,31 @@ export class AdminService {
this.countUsersWithAnalytics() this.countUsersWithAnalytics()
]); ]);
const dataProviders = await Promise.all( const dataProviders = (
dataSources.map(async (dataSource) => { await Promise.all(
const dataProviderInfo = this.dataProviderService dataSources.map(async (dataSource) => {
.getDataProvider(dataSource) const assetProfileCount =
.getDataProviderInfo(); await this.prismaService.symbolProfile.count({
where: {
dataSource
}
});
const assetProfileCount = await this.prismaService.symbolProfile.count({ if (assetProfileCount > 0 || dataSource === 'GHOSTFOLIO') {
where: { const dataProviderInfo = this.dataProviderService
dataSource .getDataProvider(dataSource)
.getDataProviderInfo();
return {
...dataProviderInfo,
assetProfileCount
};
} }
});
return { return null;
...dataProviderInfo, })
assetProfileCount )
}; ).filter(Boolean);
})
);
return { return {
dataProviders, dataProviders,

11
libs/common/src/lib/personal-finance-tools.ts

@ -446,6 +446,17 @@ export const personalFinanceTools: Product[] = [
origin: 'Pakistan', origin: 'Pakistan',
slogan: 'Advanced portfolio tracking and stock market information' slogan: 'Advanced portfolio tracking and stock market information'
}, },
{
founded: 2021,
hasFreePlan: true,
hasSelfHostingAbility: true,
key: 'invmon',
name: 'InvMon',
origin: 'Switzerland',
pricingPerYear: '$156',
slogan: 'Track all your assets, investments and portfolios in one place',
useAnonymously: true
},
{ {
founded: 2011, founded: 2011,
hasFreePlan: true, hasFreePlan: true,

Loading…
Cancel
Save