Browse Source
Task/harden validation of scraper configuration in asset profile endpoint (#7322)
* Harden validation of scraper configuration
* Update changelog
pull/7314/head^2
Thomas Kaul
17 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
41 additions and
0 deletions
-
CHANGELOG.md
-
libs/common/src/lib/dtos/index.ts
-
libs/common/src/lib/dtos/scraper-configuration.dto.ts
-
libs/common/src/lib/dtos/update-asset-profile.dto.ts
|
|
|
@ -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_ page |
|
|
|
|
|
|
|
@ -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, |
|
|
|
|
|
|
|
@ -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; |
|
|
|
} |
|
|
|
@ -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() |
|
|
|
|