|
@ -13,6 +13,7 @@ import { |
|
|
PROPERTY_DEMO_USER_ID, |
|
|
PROPERTY_DEMO_USER_ID, |
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
PROPERTY_SLACK_COMMUNITY_USERS, |
|
|
PROPERTY_SLACK_COMMUNITY_USERS, |
|
|
|
|
|
PROPERTY_STRIPE_CONFIG, |
|
|
ghostfolioFearAndGreedIndexDataSource |
|
|
ghostfolioFearAndGreedIndexDataSource |
|
|
} from '@ghostfolio/common/config'; |
|
|
} from '@ghostfolio/common/config'; |
|
|
import { |
|
|
import { |
|
@ -20,7 +21,11 @@ import { |
|
|
encodeDataSource, |
|
|
encodeDataSource, |
|
|
extractNumberFromString |
|
|
extractNumberFromString |
|
|
} from '@ghostfolio/common/helper'; |
|
|
} from '@ghostfolio/common/helper'; |
|
|
import { InfoItem, Statistics } from '@ghostfolio/common/interfaces'; |
|
|
import { |
|
|
|
|
|
InfoItem, |
|
|
|
|
|
Statistics, |
|
|
|
|
|
SubscriptionOffer |
|
|
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
|
|
|
|
|
|
import { Injectable, Logger } from '@nestjs/common'; |
|
|
import { Injectable, Logger } from '@nestjs/common'; |
|
@ -94,7 +99,8 @@ export class InfoService { |
|
|
demoAuthToken, |
|
|
demoAuthToken, |
|
|
isUserSignupEnabled, |
|
|
isUserSignupEnabled, |
|
|
platforms, |
|
|
platforms, |
|
|
statistics |
|
|
statistics, |
|
|
|
|
|
subscriptionOffer |
|
|
] = await Promise.all([ |
|
|
] = await Promise.all([ |
|
|
this.benchmarkService.getBenchmarkAssetProfiles(), |
|
|
this.benchmarkService.getBenchmarkAssetProfiles(), |
|
|
this.getDemoAuthToken(), |
|
|
this.getDemoAuthToken(), |
|
@ -102,7 +108,8 @@ export class InfoService { |
|
|
this.platformService.getPlatforms({ |
|
|
this.platformService.getPlatforms({ |
|
|
orderBy: { name: 'asc' } |
|
|
orderBy: { name: 'asc' } |
|
|
}), |
|
|
}), |
|
|
this.getStatistics() |
|
|
this.getStatistics(), |
|
|
|
|
|
this.getDefaultSubscriptionOffer() |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
if (isUserSignupEnabled) { |
|
|
if (isUserSignupEnabled) { |
|
@ -117,6 +124,7 @@ export class InfoService { |
|
|
isReadOnlyMode, |
|
|
isReadOnlyMode, |
|
|
platforms, |
|
|
platforms, |
|
|
statistics, |
|
|
statistics, |
|
|
|
|
|
subscriptionOffer, |
|
|
baseCurrency: DEFAULT_CURRENCY, |
|
|
baseCurrency: DEFAULT_CURRENCY, |
|
|
currencies: this.exchangeRateDataService.getCurrencies() |
|
|
currencies: this.exchangeRateDataService.getCurrencies() |
|
|
}; |
|
|
}; |
|
@ -230,6 +238,16 @@ export class InfoService { |
|
|
)) as string; |
|
|
)) as string; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async getDefaultSubscriptionOffer(): Promise<SubscriptionOffer> { |
|
|
|
|
|
if (!this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { |
|
|
|
|
|
return undefined; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return (await this.propertyService.getByKey(PROPERTY_STRIPE_CONFIG))?.[ |
|
|
|
|
|
'default' |
|
|
|
|
|
] as SubscriptionOffer; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private async getDemoAuthToken() { |
|
|
private async getDemoAuthToken() { |
|
|
const demoUserId = (await this.propertyService.getByKey( |
|
|
const demoUserId = (await this.propertyService.getByKey( |
|
|
PROPERTY_DEMO_USER_ID |
|
|
PROPERTY_DEMO_USER_ID |
|
|