diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index e9945cbf5..be78d668a 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -3,6 +3,7 @@ import { ConfigurationService } from '@ghostfolio/api/services/configuration.ser import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service'; import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { baseCurrency } from '@ghostfolio/common/config'; import { AdminData } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; import { differenceInDays } from 'date-fns'; @@ -19,33 +20,22 @@ export class AdminService { public async get(): Promise { return { - exchangeRates: [ - { - label1: 'EUR', - label2: 'CHF', - value: await this.exchangeRateDataService.toCurrency(1, 'EUR', 'CHF') - }, - { - label1: 'GBP', - label2: 'CHF', - value: await this.exchangeRateDataService.toCurrency(1, 'GBP', 'CHF') - }, - { - label1: 'USD', - label2: 'CHF', - value: await this.exchangeRateDataService.toCurrency(1, 'USD', 'CHF') - }, - { - label1: 'USD', - label2: 'EUR', - value: await this.exchangeRateDataService.toCurrency(1, 'USD', 'EUR') - }, - { - label1: 'USD', - label2: 'GBP', - value: await this.exchangeRateDataService.toCurrency(1, 'USD', 'GBP') - } - ], + exchangeRates: this.exchangeRateDataService + .getCurrencies() + .filter((currency) => { + return currency !== baseCurrency; + }) + .map((currency) => { + return { + label1: baseCurrency, + label2: currency, + value: this.exchangeRateDataService.toCurrency( + 1, + baseCurrency, + currency + ) + }; + }), lastDataGathering: await this.getLastDataGathering(), transactionCount: await this.prismaService.order.count(), userCount: await this.prismaService.user.count(),