Browse Source

Feature/simplify data source checks in DTOs (#4581)

* Simplify DataSource checks in DTOs

* Add test case

* Update changelog
pull/4594/head
Thomas Kaul 7 days ago
committed by GitHub
parent
commit
50e7e3d3c7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 2
      apps/api/src/app/admin/update-asset-profile.dto.ts
  3. 2
      apps/api/src/app/order/create-order.dto.ts
  4. 18
      test/import/invalid-data-source.json

2
CHANGELOG.md

@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Simplified the data source check in the DTO of the activity creation
- Simplified the data source check in the DTO of the asset profile update
- Renamed `User` to `user` in the `Subscription` database schema
- Migrated the `@ghostfolio/ui/assistant` component to control flow
- Migrated the `@ghostfolio/ui/value` component to control flow

2
apps/api/src/app/admin/update-asset-profile.dto.ts

@ -32,7 +32,7 @@ export class UpdateAssetProfileDto {
@IsOptional()
currency?: string;
@IsEnum(DataSource, { each: true })
@IsEnum(DataSource)
@IsOptional()
dataSource?: DataSource;

2
apps/api/src/app/order/create-order.dto.ts

@ -49,7 +49,7 @@ export class CreateOrderDto {
@IsOptional()
customCurrency?: string;
@IsEnum(DataSource, { each: true })
@IsEnum(DataSource)
@IsOptional()
dataSource?: DataSource;

18
test/import/invalid-data-source.json

@ -0,0 +1,18 @@
{
"meta": {
"date": "2021-01-01T00:00:00.000Z",
"version": "dev"
},
"activities": [
{
"currency": "USD",
"dataSource": "<invalid>",
"date": "2021-01-01T00:00:00.000Z",
"fee": 0,
"quantity": 20,
"symbol": "AAPL",
"type": "BUY",
"unitPrice": 100.0
}
]
}
Loading…
Cancel
Save