Browse Source
Feature/add date range support to portfolio holdings page (#3303)
* Add date range support
* Update changelog
pull/3306/head
Thomas Kaul
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
19 additions and
4 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/portfolio.controller.ts
-
apps/client/src/app/pages/portfolio/holdings/holdings-page.component.ts
-
apps/client/src/app/services/data.service.ts
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
|
## Unreleased |
|
|
## Unreleased |
|
|
|
|
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
|
|
|
|
|
|
- Added the date range support to the portfolio holdings page |
|
|
|
|
|
|
|
|
### Changed |
|
|
### Changed |
|
|
|
|
|
|
|
|
- Removed the date range support in the activities table on the portfolio activities page (experimental) |
|
|
- Removed the date range support in the activities table on the portfolio activities page (experimental) |
|
|
|
@ -290,6 +290,7 @@ export class PortfolioController { |
|
|
@Query('assetClasses') filterByAssetClasses?: string, |
|
|
@Query('assetClasses') filterByAssetClasses?: string, |
|
|
@Query('holdingType') filterByHoldingType?: string, |
|
|
@Query('holdingType') filterByHoldingType?: string, |
|
|
@Query('query') filterBySearchQuery?: string, |
|
|
@Query('query') filterBySearchQuery?: string, |
|
|
|
|
|
@Query('range') dateRange: DateRange = 'max', |
|
|
@Query('tags') filterByTags?: string |
|
|
@Query('tags') filterByTags?: string |
|
|
): Promise<PortfolioHoldingsResponse> { |
|
|
): Promise<PortfolioHoldingsResponse> { |
|
|
const filters = this.apiService.buildFiltersFromQueryParams({ |
|
|
const filters = this.apiService.buildFiltersFromQueryParams({ |
|
@ -301,6 +302,7 @@ export class PortfolioController { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const { holdings } = await this.portfolioService.getDetails({ |
|
|
const { holdings } = await this.portfolioService.getDetails({ |
|
|
|
|
|
dateRange, |
|
|
filters, |
|
|
filters, |
|
|
impersonationId, |
|
|
impersonationId, |
|
|
userId: this.request.user.id |
|
|
userId: this.request.user.id |
|
|
|
@ -123,7 +123,8 @@ export class HoldingsPageComponent implements OnDestroy, OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return this.dataService.fetchPortfolioHoldings({ |
|
|
return this.dataService.fetchPortfolioHoldings({ |
|
|
filters |
|
|
filters, |
|
|
|
|
|
range: this.user?.settings?.dateRange |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
@ -464,13 +464,21 @@ export class DataService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public fetchPortfolioHoldings({ |
|
|
public fetchPortfolioHoldings({ |
|
|
filters |
|
|
filters, |
|
|
|
|
|
range |
|
|
}: { |
|
|
}: { |
|
|
filters?: Filter[]; |
|
|
filters?: Filter[]; |
|
|
} = {}) { |
|
|
range?: DateRange; |
|
|
|
|
|
}) { |
|
|
|
|
|
let params = this.buildFiltersAsQueryParams({ filters }); |
|
|
|
|
|
|
|
|
|
|
|
if (range) { |
|
|
|
|
|
params = params.append('range', range); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return this.http |
|
|
return this.http |
|
|
.get<PortfolioHoldingsResponse>('/api/v1/portfolio/holdings', { |
|
|
.get<PortfolioHoldingsResponse>('/api/v1/portfolio/holdings', { |
|
|
params: this.buildFiltersAsQueryParams({ filters }) |
|
|
params |
|
|
}) |
|
|
}) |
|
|
.pipe( |
|
|
.pipe( |
|
|
map((response) => { |
|
|
map((response) => { |
|
|