Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/improve parsing of integer query parameter includeHistoricalData in various endpoints (#7208)

Thomas Kaulc2f3b77c9b94
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f8f19142d9..b0f53a3b92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Hardened the endpoint of the public access for portfolio sharing by restricting it to public accesses
- Improved the parsing of integer query parameters (`skip` and `take`) in the `GET api/v1/admin/user` endpoint
- Improved the parsing of integer query parameters (`skip` and `take`) in the `GET api/v1/asset-profiles` endpoint
+- Improved the parsing of the integer query parameter (`includeHistoricalData`) in the `GET api/v1/market-data/markets` endpoint
+- Improved the parsing of the integer query parameter (`includeHistoricalData`) in the `GET api/v1/symbol/:dataSource/:symbol` endpoint
- Improved the language localization by translating various tooltips across the application
- Improved the language localization for Ukrainian (`uk`)
- Upgraded `yahoo-finance2` from version `3.14.3` to `3.15.4`
diff --git a/apps/api/src/app/endpoints/market-data/market-data.controller.ts b/apps/api/src/app/endpoints/market-data/market-data.controller.ts
index 0905a50bb5..5dad0511fd 100644
--- a/apps/api/src/app/endpoints/market-data/market-data.controller.ts
+++ b/apps/api/src/app/endpoints/market-data/market-data.controller.ts
@@ -22,6 +22,7 @@ import {
HttpException,
Inject,
Param,
+ ParseIntPipe,
Post,
Query,
UseGuards
@@ -45,7 +46,8 @@ export class MarketDataController {
@HasPermission(permissions.readMarketDataOfMarkets)
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async getMarketDataOfMarkets(
- @Query('includeHistoricalData') includeHistoricalData = 0
+ @Query('includeHistoricalData', new ParseIntPipe({ optional: true }))
+ includeHistoricalData = 0
): Promise<MarketDataOfMarketsResponse> {
const [
marketDataFearAndGreedIndexCryptocurrencies,
diff --git a/apps/api/src/app/symbol/symbol.controller.ts b/apps/api/src/app/symbol/symbol.controller.ts
index 501692ae51..d94ffb4dcf 100644
--- a/apps/api/src/app/symbol/symbol.controller.ts
+++ b/apps/api/src/app/symbol/symbol.controller.ts
@@ -14,6 +14,7 @@ import {
HttpException,
Inject,
Param,
+ ParseIntPipe,
Query,
UseGuards,
UseInterceptors
@@ -69,7 +70,8 @@ export class SymbolController {
public async getSymbolData(
@Param('dataSource') dataSource: DataSource,
@Param('symbol') symbol: string,
- @Query('includeHistoricalData') includeHistoricalData = 0
+ @Query('includeHistoricalData', new ParseIntPipe({ optional: true }))
+ includeHistoricalData = 0
): Promise<SymbolItem> {
if (!DataSource[dataSource]) {
throw new HttpException(