Browse Source

Remove deprecated attributes

pull/6923/head
Thomas Kaul 3 days ago
parent
commit
12fa4e7687
  1. 24
      apps/api/src/app/endpoints/public/public.controller.ts
  2. 15
      apps/api/src/app/portfolio/portfolio.controller.ts
  3. 16
      apps/client/src/app/pages/public/public-page.component.ts
  4. 22
      libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts
  5. 23
      libs/ui/src/lib/holdings-table/holdings-table.component.html

24
apps/api/src/app/endpoints/public/public.controller.ts

@ -167,19 +167,25 @@ export class PublicController {
publicPortfolioResponse.holdings[symbol] = {
allocationInPercentage:
portfolioPosition.valueInBaseCurrency / totalValue,
assetClass: hasDetails ? portfolioPosition.assetClass : undefined,
assetProfile: hasDetails ? portfolioPosition.assetProfile : undefined,
countries: hasDetails ? portfolioPosition.countries : [],
currency: hasDetails ? portfolioPosition.currency : undefined,
dataSource: portfolioPosition.dataSource,
assetProfile: {
...portfolioPosition.assetProfile,
...(hasDetails
? {}
: {
assetClass: undefined,
assetClassLabel: undefined,
assetSubClass: undefined,
assetSubClassLabel: undefined,
countries: [],
currency: undefined,
holdings: [],
sectors: []
})
},
dateOfFirstActivity: portfolioPosition.dateOfFirstActivity,
markets: hasDetails ? portfolioPosition.markets : undefined,
name: portfolioPosition.name,
netPerformancePercentWithCurrencyEffect:
portfolioPosition.netPerformancePercentWithCurrencyEffect,
sectors: hasDetails ? portfolioPosition.sectors : [],
symbol: portfolioPosition.symbol,
url: portfolioPosition.url,
valueInPercentage: portfolioPosition.valueInBaseCurrency / totalValue
};
}

15
apps/api/src/app/portfolio/portfolio.controller.ts

@ -220,6 +220,21 @@ export class PortfolioController {
hasDetails || portfolioPosition.assetClass === AssetClass.LIQUIDITY
? portfolioPosition.assetClass
: undefined,
assetProfile: {
...portfolioPosition.assetProfile,
...(hasDetails
? {}
: {
assetClass: undefined,
assetClassLabel: undefined,
assetSubClass: undefined,
assetSubClassLabel: undefined,
countries: [],
currency: undefined,
holdings: [],
sectors: []
})
},
assetSubClass:
hasDetails || portfolioPosition.assetSubClass === AssetSubClass.CASH
? portfolioPosition.assetSubClass

16
apps/client/src/app/pages/public/public-page.component.ts

@ -172,16 +172,16 @@ export class GfPublicPageComponent implements OnInit {
this.holdings.push(position);
this.positions[symbol] = {
currency: position.currency,
name: position.name,
currency: position.assetProfile.currency,
name: position.assetProfile.name,
value: position.allocationInPercentage
};
if (position.assetClass !== AssetClass.LIQUIDITY) {
if (position.assetProfile.assetClass !== AssetClass.LIQUIDITY) {
// Prepare analysis data by continents, countries, holdings and sectors except for liquidity
if (position.countries.length > 0) {
for (const country of position.countries) {
if (position.assetProfile.countries.length > 0) {
for (const country of position.assetProfile.countries) {
const { code, continent, name, weight } = country;
if (this.continents[continent]?.value) {
@ -220,8 +220,8 @@ export class GfPublicPageComponent implements OnInit {
0;
}
if (position.sectors.length > 0) {
for (const sector of position.sectors) {
if (position.assetProfile.sectors.length > 0) {
for (const sector of position.assetProfile.sectors) {
const { name, weight } = sector;
if (this.sectors[name]?.value) {
@ -245,7 +245,7 @@ export class GfPublicPageComponent implements OnInit {
}
this.symbols[prettifySymbol(symbol)] = {
name: position.name,
name: position.assetProfile.name,
symbol: prettifySymbol(symbol),
value: isNumber(position.valueInBaseCurrency)
? position.valueInBaseCurrency

22
libs/common/src/lib/interfaces/responses/public-portfolio-response.interface.ts

@ -14,32 +14,10 @@ export interface PublicPortfolioResponse extends PublicPortfolioResponseV1 {
[symbol: string]: Pick<
PortfolioPosition,
| 'allocationInPercentage'
/** @deprecated */
| 'assetClass'
| 'assetProfile'
/** @deprecated */
| 'countries'
| 'currency'
/** @deprecated */
| 'dataSource'
| 'dateOfFirstActivity'
| 'markets'
/** @deprecated */
| 'name'
| 'netPerformancePercentWithCurrencyEffect'
/** @deprecated */
| 'sectors'
/** @deprecated */
| 'symbol'
/** @deprecated */
| 'url'
| 'valueInBaseCurrency'
| 'valueInPercentage'
>;

23
libs/ui/src/lib/holdings-table/holdings-table.component.html

@ -11,26 +11,31 @@
<th *matHeaderCellDef class="px-1" mat-header-cell></th>
<td *matCellDef="let element" class="px-1 text-center" mat-cell>
<gf-entity-logo
[dataSource]="element.dataSource"
[symbol]="element.symbol"
[tooltip]="element.name"
[dataSource]="element.assetProfile.dataSource"
[symbol]="element.assetProfile.symbol"
[tooltip]="element.assetProfile.name"
/>
</td>
</ng-container>
<ng-container matColumnDef="nameWithSymbol">
<th *matHeaderCellDef class="px-1" mat-header-cell mat-sort-header="name">
<th
*matHeaderCellDef
class="px-1"
mat-header-cell
mat-sort-header="assetProfile.name"
>
<ng-container i18n>Name</ng-container>
</th>
<td *matCellDef="let element" class="line-height-1 px-1" mat-cell>
<div class="text-truncate">
{{ element.name }}
@if (element.name === element.symbol) {
{{ element.assetProfile.name }}
@if (element.assetProfile.name === element.assetProfile.symbol) {
<span>({{ element.assetProfile.assetSubClassLabel }})</span>
}
</div>
<div>
<small class="text-muted">{{ element.symbol }}</small>
<small class="text-muted">{{ element.assetProfile.symbol }}</small>
</div>
</td>
</ng-container>
@ -185,8 +190,8 @@
(click)="
canShowDetails(row) &&
onOpenHoldingDialog({
dataSource: row.dataSource,
symbol: row.symbol
dataSource: row.assetProfile.dataSource,
symbol: row.assetProfile.symbol
})
"
></tr>

Loading…
Cancel
Save