Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Task/harden validation of scraper configuration in asset profile endpoint (#7322)
Thomas Kaul00c37f026cc1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 85df11fdb5..a0a652c449 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Hardened the validation of the countries in the asset profile endpoints- Hardened the validation of the holdings in the asset profile endpoints+- Hardened the validation of the scraper configuration in the asset profile endpoint- Hardened the validation of the sectors in the asset profile endpoints- Rounded the value of the _Fear & Greed Index_ (market mood) in the twitter bot service- Set the change detection strategy to `OnPush` in the _X-ray_ pagediff --git a/libs/common/src/lib/dtos/index.ts b/libs/common/src/lib/dtos/index.tsindex c531313a63..7851153565 100644--- a/libs/common/src/lib/dtos/index.ts+++ b/libs/common/src/lib/dtos/index.ts@@ -12,6 +12,7 @@ import { CreateTagDto } from './create-tag.dto';import { CreateWatchlistItemDto } from './create-watchlist-item.dto';import { DeleteOwnUserDto } from './delete-own-user.dto';import { HoldingDto } from './holding.dto';+import { ScraperConfigurationDto } from './scraper-configuration.dto';import { SectorDto } from './sector.dto';import { TransferBalanceDto } from './transfer-balance.dto';import { UpdateAccessDto } from './update-access.dto';@@ -42,6 +43,7 @@ export {CreateWatchlistItemDto,DeleteOwnUserDto,HoldingDto,+ ScraperConfigurationDto,SectorDto,TransferBalanceDto,UpdateAccessDto,diff --git a/libs/common/src/lib/dtos/scraper-configuration.dto.ts b/libs/common/src/lib/dtos/scraper-configuration.dto.tsnew file mode 100644index 0000000000..52cadb80cc--- /dev/null+++ b/libs/common/src/lib/dtos/scraper-configuration.dto.ts@@ -0,0 +1,35 @@+import {+ IsIn,+ IsNumber,+ IsObject,+ IsOptional,+ IsString,+ IsUrl+} from 'class-validator';++export class ScraperConfigurationDto {+ @IsNumber()+ @IsOptional()+ defaultMarketPrice?: number;++ @IsObject()+ @IsOptional()+ headers?: { [key: string]: string };++ @IsOptional()+ @IsString()+ locale?: string;++ @IsIn(['instant', 'lazy'])+ @IsOptional()+ mode?: 'instant' | 'lazy';++ @IsString()+ selector: string;++ @IsUrl({+ protocols: ['http', 'https'],+ require_protocol: true+ })+ url: string;+}diff --git a/libs/common/src/lib/dtos/update-asset-profile.dto.ts b/libs/common/src/lib/dtos/update-asset-profile.dto.tsindex 2204fd0abd..a6e2230e8e 100644--- a/libs/common/src/lib/dtos/update-asset-profile.dto.ts+++ b/libs/common/src/lib/dtos/update-asset-profile.dto.ts@@ -21,6 +21,7 @@ import {import { CountryDto } from './country.dto';import { HoldingDto } from './holding.dto';+import { ScraperConfigurationDto } from './scraper-configuration.dto';import { SectorDto } from './sector.dto';export class UpdateAssetProfileDto {@@ -70,6 +71,8 @@ export class UpdateAssetProfileDto {@IsObject()@IsOptional()+ @Type(() => ScraperConfigurationDto)+ @ValidateNested()scraperConfiguration?: Prisma.InputJsonObject;@IsArray()