Feature/improve import json file validation (#455)

* Improve import validation

* Update changelog
pull/456/head
Thomas Kaul 3 years ago committed by GitHub
parent 7f3f75386d
commit b6902e10ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Improved the validation of `json` files in the import functionality for transactions
## 1.69.0 - 07.11.2021
### Added

@ -12,6 +12,7 @@ import { User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DataSource, Order as OrderModel } from '@prisma/client';
import { format, parseISO } from 'date-fns';
import { isArray } from 'lodash';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@ -189,6 +190,11 @@ export class TransactionsPageComponent implements OnDestroy, OnInit {
try {
if (file.type === 'application/json') {
const content = JSON.parse(fileContent);
if (!isArray(content.orders)) {
throw new Error();
}
try {
await this.importTransactionsService.importJson({
content: content.orders,

Loading…
Cancel
Save