diff --git a/CHANGELOG.md b/CHANGELOG.md index ac62bb06c..ffa35cf41 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/apps/api/src/app/admin/update-asset-profile.dto.ts b/apps/api/src/app/admin/update-asset-profile.dto.ts index 45923410a..5056dccdb 100644 --- a/apps/api/src/app/admin/update-asset-profile.dto.ts +++ b/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; diff --git a/apps/api/src/app/order/create-order.dto.ts b/apps/api/src/app/order/create-order.dto.ts index f40e65ba1..c2b10fd81 100644 --- a/apps/api/src/app/order/create-order.dto.ts +++ b/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; diff --git a/test/import/invalid-data-source.json b/test/import/invalid-data-source.json new file mode 100644 index 000000000..472e295ee --- /dev/null +++ b/test/import/invalid-data-source.json @@ -0,0 +1,18 @@ +{ + "meta": { + "date": "2021-01-01T00:00:00.000Z", + "version": "dev" + }, + "activities": [ + { + "currency": "USD", + "dataSource": "", + "date": "2021-01-01T00:00:00.000Z", + "fee": 0, + "quantity": 20, + "symbol": "AAPL", + "type": "BUY", + "unitPrice": 100.0 + } + ] +}