|
|
@ -14,6 +14,7 @@ import { |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
PROPERTY_IS_USER_SIGNUP_ENABLED |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
applySymbolProfileOverrides, |
|
|
getAssetProfileIdentifier, |
|
|
getAssetProfileIdentifier, |
|
|
getCurrencyFromSymbol, |
|
|
getCurrencyFromSymbol, |
|
|
isCurrency |
|
|
isCurrency |
|
|
@ -29,7 +30,6 @@ import { |
|
|
EnhancedSymbolProfile, |
|
|
EnhancedSymbolProfile, |
|
|
Filter |
|
|
Filter |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
import { Sector } from '@ghostfolio/common/interfaces/sector.interface'; |
|
|
|
|
|
import { MarketDataPreset } from '@ghostfolio/common/types'; |
|
|
import { MarketDataPreset } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
@ -349,87 +349,61 @@ export class AdminService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let marketData: AdminMarketDataItem[] = await Promise.all( |
|
|
let marketData: AdminMarketDataItem[] = await Promise.all( |
|
|
assetProfiles.map( |
|
|
assetProfiles.map(async (assetProfile) => { |
|
|
async ({ |
|
|
const { |
|
|
_count, |
|
|
_count, |
|
|
activities, |
|
|
activities, |
|
|
assetClass, |
|
|
|
|
|
assetSubClass, |
|
|
|
|
|
comment, |
|
|
comment, |
|
|
countries, |
|
|
|
|
|
currency, |
|
|
currency, |
|
|
dataSource, |
|
|
dataSource, |
|
|
id, |
|
|
id, |
|
|
isActive, |
|
|
isActive, |
|
|
isUsedByUsersWithSubscription, |
|
|
isUsedByUsersWithSubscription, |
|
|
name, |
|
|
symbol |
|
|
sectors, |
|
|
} = assetProfile; |
|
|
symbol, |
|
|
|
|
|
SymbolProfileOverrides |
|
|
|
|
|
}) => { |
|
|
|
|
|
let countriesCount = countries ? Object.keys(countries).length : 0; |
|
|
|
|
|
|
|
|
|
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
const { assetClass, assetSubClass, countries, name, sectors } = |
|
|
getAssetProfileIdentifier({ dataSource, symbol }) |
|
|
applySymbolProfileOverrides( |
|
|
|
|
|
assetProfile, |
|
|
|
|
|
assetProfile.SymbolProfileOverrides |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const marketDataItemCount = |
|
|
const countriesCount = countries ? Object.keys(countries).length : 0; |
|
|
marketDataItems.find((marketDataItem) => { |
|
|
|
|
|
return ( |
|
|
|
|
|
marketDataItem.dataSource === dataSource && |
|
|
|
|
|
marketDataItem.symbol === symbol |
|
|
|
|
|
); |
|
|
|
|
|
})?._count ?? 0; |
|
|
|
|
|
|
|
|
|
|
|
let sectorsCount = sectors ? Object.keys(sectors).length : 0; |
|
|
|
|
|
|
|
|
|
|
|
if (SymbolProfileOverrides) { |
|
|
|
|
|
assetClass = SymbolProfileOverrides.assetClass ?? assetClass; |
|
|
|
|
|
assetSubClass = |
|
|
|
|
|
SymbolProfileOverrides.assetSubClass ?? assetSubClass; |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
(SymbolProfileOverrides.countries as unknown as Prisma.JsonArray) |
|
|
|
|
|
?.length > 0 |
|
|
|
|
|
) { |
|
|
|
|
|
countriesCount = ( |
|
|
|
|
|
SymbolProfileOverrides.countries as unknown as Prisma.JsonArray |
|
|
|
|
|
).length; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
name = SymbolProfileOverrides.name ?? name; |
|
|
const lastMarketPrice = lastMarketPriceMap.get( |
|
|
|
|
|
getAssetProfileIdentifier({ dataSource, symbol }) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
if ( |
|
|
const marketDataItemCount = |
|
|
(SymbolProfileOverrides.sectors as unknown as Sector[])?.length > |
|
|
marketDataItems.find((marketDataItem) => { |
|
|
0 |
|
|
return ( |
|
|
) { |
|
|
marketDataItem.dataSource === dataSource && |
|
|
sectorsCount = ( |
|
|
marketDataItem.symbol === symbol |
|
|
SymbolProfileOverrides.sectors as unknown as Prisma.JsonArray |
|
|
); |
|
|
).length; |
|
|
})?._count ?? 0; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
const sectorsCount = sectors ? Object.keys(sectors).length : 0; |
|
|
assetClass, |
|
|
|
|
|
assetSubClass, |
|
|
return { |
|
|
comment, |
|
|
assetClass, |
|
|
countriesCount, |
|
|
assetSubClass, |
|
|
currency, |
|
|
comment, |
|
|
dataSource, |
|
|
countriesCount, |
|
|
id, |
|
|
currency, |
|
|
isActive, |
|
|
dataSource, |
|
|
lastMarketPrice, |
|
|
id, |
|
|
marketDataItemCount, |
|
|
isActive, |
|
|
name, |
|
|
lastMarketPrice, |
|
|
sectorsCount, |
|
|
marketDataItemCount, |
|
|
symbol, |
|
|
name, |
|
|
activitiesCount: _count.activities, |
|
|
sectorsCount, |
|
|
date: activities?.[0]?.date, |
|
|
symbol, |
|
|
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription, |
|
|
activitiesCount: _count.activities, |
|
|
watchedByCount: _count.watchedBy |
|
|
date: activities?.[0]?.date, |
|
|
}; |
|
|
isUsedByUsersWithSubscription: await isUsedByUsersWithSubscription, |
|
|
} |
|
|
watchedByCount: _count.watchedBy |
|
|
) |
|
|
}; |
|
|
|
|
|
}) |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (presetId) { |
|
|
if (presetId) { |
|
|
|