|
@ -15,7 +15,11 @@ import { |
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { isCurrency, getCurrencyFromSymbol, getAssetProfileIdentifier } from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
|
|
|
isCurrency, |
|
|
|
|
|
getAssetProfileIdentifier, |
|
|
|
|
|
getCurrencyFromSymbol |
|
|
|
|
|
} from '@ghostfolio/common/helper'; |
|
|
import { |
|
|
import { |
|
|
AdminData, |
|
|
AdminData, |
|
|
AdminMarketData, |
|
|
AdminMarketData, |
|
@ -278,7 +282,10 @@ export class AdminService { |
|
|
const lastMarketPriceMap = new Map<string, number>(); |
|
|
const lastMarketPriceMap = new Map<string, number>(); |
|
|
|
|
|
|
|
|
for (const { symbol, dataSource, marketPrice } of lastMarketPrices) { |
|
|
for (const { symbol, dataSource, marketPrice } of lastMarketPrices) { |
|
|
lastMarketPriceMap.set(getAssetProfileIdentifier({dataSource, symbol}), marketPrice); |
|
|
lastMarketPriceMap.set( |
|
|
|
|
|
getAssetProfileIdentifier({ dataSource, symbol }), |
|
|
|
|
|
marketPrice |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let marketData: AdminMarketDataItem[] = await Promise.all( |
|
|
let marketData: AdminMarketDataItem[] = await Promise.all( |
|
@ -310,7 +317,7 @@ export class AdminService { |
|
|
})?._count ?? 0; |
|
|
})?._count ?? 0; |
|
|
const sectorsCount = sectors ? Object.keys(sectors).length : 0; |
|
|
const sectorsCount = sectors ? Object.keys(sectors).length : 0; |
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
getAssetProfileIdentifier({dataSource, symbol}) |
|
|
getAssetProfileIdentifier({ dataSource, symbol }) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
@ -328,8 +335,7 @@ export class AdminService { |
|
|
sectorsCount, |
|
|
sectorsCount, |
|
|
activitiesCount: _count.Order, |
|
|
activitiesCount: _count.Order, |
|
|
date: Order?.[0]?.date, |
|
|
date: Order?.[0]?.date, |
|
|
isUsedByUsersWithSubscription: |
|
|
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription |
|
|
await isUsedByUsersWithSubscription |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
@ -560,7 +566,10 @@ export class AdminService { |
|
|
|
|
|
|
|
|
const lastMarketPriceMap = new Map<string, number>(); |
|
|
const lastMarketPriceMap = new Map<string, number>(); |
|
|
for (const { symbol, dataSource, marketPrice } of lastMarketPrices) { |
|
|
for (const { symbol, dataSource, marketPrice } of lastMarketPrices) { |
|
|
lastMarketPriceMap.set(getAssetProfileIdentifier({dataSource, symbol}), marketPrice); |
|
|
lastMarketPriceMap.set( |
|
|
|
|
|
getAssetProfileIdentifier({ dataSource, symbol }), |
|
|
|
|
|
marketPrice |
|
|
|
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const marketDataPromise: Promise<AdminMarketDataItem>[] = currencyPairs.map( |
|
|
const marketDataPromise: Promise<AdminMarketDataItem>[] = currencyPairs.map( |
|
@ -583,7 +592,7 @@ export class AdminService { |
|
|
); |
|
|
); |
|
|
})?._count ?? 0; |
|
|
})?._count ?? 0; |
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
getAssetProfileIdentifier({dataSource, symbol}) |
|
|
getAssetProfileIdentifier({ dataSource, symbol }) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|