Browse Source
Task/move referral partners to database (#7060)
* Move referral partners to database
pull/7062/head
Thomas Kaul
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with
27 additions and
19 deletions
-
apps/api/src/app/user/user.service.ts
-
apps/client/src/app/pages/pricing/pricing-page.component.ts
-
apps/client/src/app/pages/pricing/pricing-page.html
-
libs/common/src/lib/config.ts
-
libs/common/src/lib/interfaces/index.ts
-
libs/common/src/lib/interfaces/referral-partner.interface.ts
-
libs/common/src/lib/interfaces/user.interface.ts
|
|
|
@ -29,6 +29,7 @@ import { |
|
|
|
DEFAULT_DATE_RANGE, |
|
|
|
DEFAULT_LANGUAGE_CODE, |
|
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
|
PROPERTY_REFERRAL_PARTNERS, |
|
|
|
PROPERTY_SYSTEM_MESSAGE, |
|
|
|
TAG_ID_EXCLUDE_FROM_ANALYSIS, |
|
|
|
locale as defaultLocale |
|
|
|
@ -36,6 +37,7 @@ import { |
|
|
|
import { SubscriptionType } from '@ghostfolio/common/enums'; |
|
|
|
import { |
|
|
|
User as IUser, |
|
|
|
ReferralPartner, |
|
|
|
SystemMessage, |
|
|
|
UserSettings |
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
@ -153,6 +155,17 @@ export class UserService { |
|
|
|
(impersonationUserSettings?.settings as UserSettings)?.baseCurrency ?? |
|
|
|
(settings.settings as UserSettings)?.baseCurrency; |
|
|
|
|
|
|
|
let referralPartners: ReferralPartner[]; |
|
|
|
|
|
|
|
if ( |
|
|
|
this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION') && |
|
|
|
subscription.type === SubscriptionType.Basic |
|
|
|
) { |
|
|
|
referralPartners = await this.propertyService.getByKey<ReferralPartner[]>( |
|
|
|
PROPERTY_REFERRAL_PARTNERS |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
let systemMessage: SystemMessage; |
|
|
|
|
|
|
|
const systemMessageProperty = |
|
|
|
@ -179,6 +192,7 @@ export class UserService { |
|
|
|
activitiesCount, |
|
|
|
id, |
|
|
|
permissions, |
|
|
|
referralPartners, |
|
|
|
subscription, |
|
|
|
systemMessage, |
|
|
|
tags, |
|
|
|
|
|
|
|
@ -68,20 +68,6 @@ export class GfPricingPageComponent implements OnInit { |
|
|
|
'PROFESSIONAL_DATA_PROVIDER_TOOLTIP_PREMIUM' |
|
|
|
); |
|
|
|
|
|
|
|
protected readonly referralBrokers = [ |
|
|
|
'Alpian', |
|
|
|
'DEGIRO', |
|
|
|
'finpension', |
|
|
|
'frankly', |
|
|
|
'Interactive Brokers', |
|
|
|
'Mintos', |
|
|
|
'Monefit SmartSaver', |
|
|
|
'Revolut', |
|
|
|
'Swissquote', |
|
|
|
'VIAC', |
|
|
|
'Zak' |
|
|
|
] as const; |
|
|
|
|
|
|
|
protected readonly routerLinkFeatures = publicRoutes.features.routerLink; |
|
|
|
protected readonly routerLinkRegister = publicRoutes.register.routerLink; |
|
|
|
protected user: User; |
|
|
|
|
|
|
|
@ -305,23 +305,23 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@if (user?.subscription?.type === 'Basic') { |
|
|
|
@if (user?.referralPartners?.length) { |
|
|
|
<div class="row"> |
|
|
|
<div class="col mt-3"> |
|
|
|
<p> |
|
|
|
<ng-container i18n>If you plan to open an account at</ng-container> |
|
|
|
<ng-container> </ng-container> |
|
|
|
@for ( |
|
|
|
broker of referralBrokers; |
|
|
|
track broker; |
|
|
|
partner of user.referralPartners; |
|
|
|
track partner.name; |
|
|
|
let i = $index; |
|
|
|
let last = $last |
|
|
|
) { |
|
|
|
<i>{{ broker }}</i> |
|
|
|
<i>{{ partner.name }}</i> |
|
|
|
@if (last) { |
|
|
|
<span>, </span> |
|
|
|
} @else { |
|
|
|
@if (i === referralBrokers.length - 2) { |
|
|
|
@if (i === user.referralPartners.length - 2) { |
|
|
|
<ng-container> </ng-container> |
|
|
|
<ng-container i18n>or</ng-container> |
|
|
|
<ng-container> </ng-container> |
|
|
|
|
|
|
|
@ -253,6 +253,7 @@ export const PROPERTY_IS_READ_ONLY_MODE = 'IS_READ_ONLY_MODE'; |
|
|
|
export const PROPERTY_IS_USER_SIGNUP_ENABLED = 'IS_USER_SIGNUP_ENABLED'; |
|
|
|
export const PROPERTY_OPENROUTER_MODEL = 'OPENROUTER_MODEL'; |
|
|
|
export const PROPERTY_OPENROUTER_MODEL_WEB_FETCH = 'OPENROUTER_MODEL_WEB_FETCH'; |
|
|
|
export const PROPERTY_REFERRAL_PARTNERS = 'REFERRAL_PARTNERS'; |
|
|
|
export const PROPERTY_SLACK_COMMUNITY_USERS = 'SLACK_COMMUNITY_USERS'; |
|
|
|
export const PROPERTY_STRIPE_CONFIG = 'STRIPE_CONFIG'; |
|
|
|
export const PROPERTY_SYSTEM_MESSAGE = 'SYSTEM_MESSAGE'; |
|
|
|
|
|
|
|
@ -38,6 +38,7 @@ import type { PortfolioPosition } from './portfolio-position.interface'; |
|
|
|
import type { PortfolioReportRule } from './portfolio-report-rule.interface'; |
|
|
|
import type { PortfolioSummary } from './portfolio-summary.interface'; |
|
|
|
import type { Product } from './product'; |
|
|
|
import type { ReferralPartner } from './referral-partner.interface'; |
|
|
|
import type { AccessTokenResponse } from './responses/access-token-response.interface'; |
|
|
|
import type { AccountBalancesResponse } from './responses/account-balances-response.interface'; |
|
|
|
import type { AccountResponse } from './responses/account-response.interface'; |
|
|
|
@ -181,6 +182,7 @@ export { |
|
|
|
PublicKeyCredentialRequestOptionsJSON, |
|
|
|
PublicPortfolioResponse, |
|
|
|
QuotesResponse, |
|
|
|
ReferralPartner, |
|
|
|
ResponseError, |
|
|
|
RuleSettings, |
|
|
|
ScraperConfiguration, |
|
|
|
|
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
export interface ReferralPartner { |
|
|
|
name: string; |
|
|
|
} |
|
|
|
@ -3,6 +3,7 @@ import { AccountWithPlatform } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
import { Access, Tag } from '@prisma/client'; |
|
|
|
|
|
|
|
import { ReferralPartner } from './referral-partner.interface'; |
|
|
|
import { SubscriptionOffer } from './subscription-offer.interface'; |
|
|
|
import { SystemMessage } from './system-message.interface'; |
|
|
|
import { UserSettings } from './user-settings.interface'; |
|
|
|
@ -15,6 +16,7 @@ export interface User { |
|
|
|
dateOfFirstActivity: Date; |
|
|
|
id: string; |
|
|
|
permissions: string[]; |
|
|
|
referralPartners?: ReferralPartner[]; |
|
|
|
settings: UserSettings; |
|
|
|
systemMessage?: SystemMessage; |
|
|
|
subscription: { |
|
|
|
|