Browse Source

Merge remote-tracking branch 'refs/remotes/upstream/main' into fix/consistent-type-assertions

# Conflicts:
#	CHANGELOG.md
#	apps/api/src/app/user/update-user-setting.dto.ts
pull/3982/head
dw-0 10 months ago
parent
commit
b12d238b29
  1. 4
      CHANGELOG.md
  2. 28
      apps/api/src/app/portfolio/portfolio.service.ts
  3. 7
      apps/api/src/app/user/update-user-setting.dto.ts
  4. 7
      apps/client/src/app/components/home-holdings/home-holdings.component.ts
  5. 6
      apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts
  6. 2
      apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts
  7. 6
      apps/client/src/app/components/rule/rule.component.ts
  8. 6
      apps/client/src/app/components/rules/rules.component.ts
  9. 2
      apps/client/src/app/components/toggle/toggle.component.ts
  10. 5
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
  11. 6
      libs/common/src/lib/interfaces/index.ts
  12. 0
      libs/common/src/lib/interfaces/toggle-option.interface.ts
  13. 4
      libs/common/src/lib/interfaces/user-settings.interface.ts
  14. 0
      libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts
  15. 6
      libs/common/src/lib/types/index.ts

4
CHANGELOG.md

@ -9,8 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Switched the `no-empty-function` rule from `warn` to `error` in the `eslint` configuration
- Switched the `consistent-type-definitions` rule from `warn` to `error` in the `eslint` configuration - Switched the `consistent-type-definitions` rule from `warn` to `error` in the `eslint` configuration
- Switched the `no-empty-function` rule from `warn` to `error` in the `eslint` configuration
- Switched the `prefer-function-type` rule from `warn` to `error` in the `eslint` configuration - Switched the `prefer-function-type` rule from `warn` to `error` in the `eslint` configuration
- Switched the `consistent-type-assertions` rule from `warn` to `error` in the `eslint` configuration - Switched the `consistent-type-assertions` rule from `warn` to `error` in the `eslint` configuration
@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed an issue with the X-axis scale of the dividend timeline on the analysis page - Fixed an issue with the X-axis scale of the dividend timeline on the analysis page
- Fixed an issue with the X-axis scale of the investment timeline on the analysis page - Fixed an issue with the X-axis scale of the investment timeline on the analysis page
- Fixed an issue with the X-axis scale of the portfolio evolution chart on the analysis page - Fixed an issue with the X-axis scale of the portfolio evolution chart on the analysis page
- Fixed an issue in the calculation of the static portfolio analysis rule: Allocation Cluster Risk (Developed Markets)
- Fixed an issue in the calculation of the static portfolio analysis rule: Allocation Cluster Risk (Emerging Markets)
## 2.118.0 - 2024-10-23 ## 2.118.0 - 2024-10-23

28
apps/api/src/app/portfolio/portfolio.service.ts

@ -1169,6 +1169,12 @@ export class PortfolioService {
withSummary: true withSummary: true
}); });
const marketsTotalInBaseCurrency = getSum(
Object.values(markets).map(({ valueInBaseCurrency }) => {
return new Big(valueInBaseCurrency);
})
).toNumber();
return { return {
rules: { rules: {
accountClusterRisk: accountClusterRisk:
@ -1193,12 +1199,12 @@ export class PortfolioService {
[ [
new AllocationClusterRiskDevelopedMarkets( new AllocationClusterRiskDevelopedMarkets(
this.exchangeRateDataService, this.exchangeRateDataService,
summary.currentValueInBaseCurrency, marketsTotalInBaseCurrency,
markets.developedMarkets.valueInBaseCurrency markets.developedMarkets.valueInBaseCurrency
), ),
new AllocationClusterRiskEmergingMarkets( new AllocationClusterRiskEmergingMarkets(
this.exchangeRateDataService, this.exchangeRateDataService,
summary.currentValueInBaseCurrency, marketsTotalInBaseCurrency,
markets.emergingMarkets.valueInBaseCurrency markets.emergingMarkets.valueInBaseCurrency
) )
], ],
@ -1358,20 +1364,20 @@ export class PortfolioService {
} }
} }
const marketsTotal = const marketsTotalInBaseCurrency = getSum(
markets.developedMarkets.valueInBaseCurrency + Object.values(markets).map(({ valueInBaseCurrency }) => {
markets.emergingMarkets.valueInBaseCurrency + return new Big(valueInBaseCurrency);
markets.otherMarkets.valueInBaseCurrency + })
markets[UNKNOWN_KEY].valueInBaseCurrency; ).toNumber();
markets.developedMarkets.valueInPercentage = markets.developedMarkets.valueInPercentage =
markets.developedMarkets.valueInBaseCurrency / marketsTotal; markets.developedMarkets.valueInBaseCurrency / marketsTotalInBaseCurrency;
markets.emergingMarkets.valueInPercentage = markets.emergingMarkets.valueInPercentage =
markets.emergingMarkets.valueInBaseCurrency / marketsTotal; markets.emergingMarkets.valueInBaseCurrency / marketsTotalInBaseCurrency;
markets.otherMarkets.valueInPercentage = markets.otherMarkets.valueInPercentage =
markets.otherMarkets.valueInBaseCurrency / marketsTotal; markets.otherMarkets.valueInBaseCurrency / marketsTotalInBaseCurrency;
markets[UNKNOWN_KEY].valueInPercentage = markets[UNKNOWN_KEY].valueInPercentage =
markets[UNKNOWN_KEY].valueInBaseCurrency / marketsTotal; markets[UNKNOWN_KEY].valueInBaseCurrency / marketsTotalInBaseCurrency;
const marketsAdvancedTotal = const marketsAdvancedTotal =
marketsAdvanced.asiaPacific.valueInBaseCurrency + marketsAdvanced.asiaPacific.valueInBaseCurrency +

7
apps/api/src/app/user/update-user-setting.dto.ts

@ -1,9 +1,10 @@
import { IsCurrencyCode } from '@ghostfolio/api/validators/is-currency-code';
import { XRayRulesSettings } from '@ghostfolio/common/interfaces';
import type { import type {
ColorScheme, ColorScheme,
DateRange, DateRange,
HoldingsViewMode, HoldingsViewMode,
ViewMode, ViewMode
XRayRulesSettings
} from '@ghostfolio/common/types'; } from '@ghostfolio/common/types';
import { import {
@ -17,8 +18,6 @@ import {
} from 'class-validator'; } from 'class-validator';
import { eachYearOfInterval, format } from 'date-fns'; import { eachYearOfInterval, format } from 'date-fns';
import { IsCurrencyCode } from '../../validators/is-currency-code';
export class UpdateUserSettingDto { export class UpdateUserSettingDto {
@IsNumber() @IsNumber()
@IsOptional() @IsOptional()

7
apps/client/src/app/components/home-holdings/home-holdings.component.ts

@ -4,14 +4,11 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
import { import {
AssetProfileIdentifier, AssetProfileIdentifier,
PortfolioPosition, PortfolioPosition,
ToggleOption,
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { import { HoldingType, HoldingsViewMode } from '@ghostfolio/common/types';
HoldingType,
HoldingsViewMode,
ToggleOption
} from '@ghostfolio/common/types';
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';

6
apps/client/src/app/components/rule/rule-settings-dialog/interfaces/interfaces.ts

@ -1,5 +1,7 @@
import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; import {
import { XRayRulesSettings } from '@ghostfolio/common/types'; PortfolioReportRule,
XRayRulesSettings
} from '@ghostfolio/common/interfaces';
export interface IRuleSettingsDialogParams { export interface IRuleSettingsDialogParams {
rule: PortfolioReportRule; rule: PortfolioReportRule;

2
apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts

@ -1,4 +1,4 @@
import { XRayRulesSettings } from '@ghostfolio/common/types'; import { XRayRulesSettings } from '@ghostfolio/common/interfaces';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, Inject } from '@angular/core'; import { Component, Inject } from '@angular/core';

6
apps/client/src/app/components/rule/rule.component.ts

@ -1,7 +1,9 @@
import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto'; import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto';
import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface';
import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; import {
import { XRayRulesSettings } from '@ghostfolio/common/types'; PortfolioReportRule,
XRayRulesSettings
} from '@ghostfolio/common/interfaces';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,

6
apps/client/src/app/components/rules/rules.component.ts

@ -1,6 +1,8 @@
import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto'; import { UpdateUserSettingDto } from '@ghostfolio/api/app/user/update-user-setting.dto';
import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; import {
import { XRayRulesSettings } from '@ghostfolio/common/types'; PortfolioReportRule,
XRayRulesSettings
} from '@ghostfolio/common/interfaces';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,

2
apps/client/src/app/components/toggle/toggle.component.ts

@ -1,4 +1,4 @@
import { ToggleOption } from '@ghostfolio/common/types'; import { ToggleOption } from '@ghostfolio/common/interfaces';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,

5
apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

@ -4,13 +4,14 @@ import { ImpersonationStorageService } from '@ghostfolio/client/services/imperso
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { import {
HistoricalDataItem, HistoricalDataItem,
InvestmentItem,
PortfolioInvestments, PortfolioInvestments,
PortfolioPerformance, PortfolioPerformance,
PortfolioPosition, PortfolioPosition,
ToggleOption,
User User
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
import { InvestmentItem } from '@ghostfolio/common/interfaces/investment-item.interface'; import { GroupBy } from '@ghostfolio/common/types';
import { GroupBy, ToggleOption } from '@ghostfolio/common/types';
import { translate } from '@ghostfolio/ui/i18n'; import { translate } from '@ghostfolio/ui/i18n';
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';

6
libs/common/src/lib/interfaces/index.ts

@ -50,8 +50,10 @@ import type { Subscription } from './subscription.interface';
import type { SymbolMetrics } from './symbol-metrics.interface'; import type { SymbolMetrics } from './symbol-metrics.interface';
import type { SystemMessage } from './system-message.interface'; import type { SystemMessage } from './system-message.interface';
import type { TabConfiguration } from './tab-configuration.interface'; import type { TabConfiguration } from './tab-configuration.interface';
import type { ToggleOption } from './toggle-option.interface';
import type { UserSettings } from './user-settings.interface'; import type { UserSettings } from './user-settings.interface';
import type { User } from './user.interface'; import type { User } from './user.interface';
import type { XRayRulesSettings } from './x-ray-rules-settings.interface';
export { export {
Access, Access,
@ -104,6 +106,8 @@ export {
Subscription, Subscription,
SymbolMetrics, SymbolMetrics,
TabConfiguration, TabConfiguration,
ToggleOption,
User, User,
UserSettings UserSettings,
XRayRulesSettings
}; };

0
libs/common/src/lib/types/toggle-option.type.ts → libs/common/src/lib/interfaces/toggle-option.interface.ts

4
libs/common/src/lib/interfaces/user-settings.interface.ts

@ -1,9 +1,9 @@
import { XRayRulesSettings } from '@ghostfolio/common/interfaces/x-ray-rules-settings.interface';
import { import {
ColorScheme, ColorScheme,
DateRange, DateRange,
HoldingsViewMode, HoldingsViewMode,
ViewMode, ViewMode
XRayRulesSettings
} from '@ghostfolio/common/types'; } from '@ghostfolio/common/types';
export interface UserSettings { export interface UserSettings {

0
libs/common/src/lib/types/x-ray-rules-settings.type.ts → libs/common/src/lib/interfaces/x-ray-rules-settings.interface.ts

6
libs/common/src/lib/types/index.ts

@ -16,10 +16,8 @@ import type { Market } from './market.type';
import type { OrderWithAccount } from './order-with-account.type'; import type { OrderWithAccount } from './order-with-account.type';
import type { RequestWithUser } from './request-with-user.type'; import type { RequestWithUser } from './request-with-user.type';
import type { SubscriptionOffer } from './subscription-offer.type'; import type { SubscriptionOffer } from './subscription-offer.type';
import type { ToggleOption } from './toggle-option.type';
import type { UserWithSettings } from './user-with-settings.type'; import type { UserWithSettings } from './user-with-settings.type';
import type { ViewMode } from './view-mode.type'; import type { ViewMode } from './view-mode.type';
import type { XRayRulesSettings } from './x-ray-rules-settings.type';
export type { export type {
AccessType, AccessType,
@ -40,8 +38,6 @@ export type {
OrderWithAccount, OrderWithAccount,
RequestWithUser, RequestWithUser,
SubscriptionOffer, SubscriptionOffer,
ToggleOption,
UserWithSettings, UserWithSettings,
ViewMode, ViewMode
XRayRulesSettings
}; };

Loading…
Cancel
Save