Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/check currency in import validation (#538)
Thomas Kaule255b76053f0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 09c8e6e48b..da8dc913b6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## Unreleasd+### Added++- Extended the validation in the import functionality for transactions by checking the currency of the data provider service+### Changed- Removed the default transactions import limitdiff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.tsindex cf9f6f7058..b17404ae98 100644--- a/apps/api/src/app/import/import.service.ts+++ b/apps/api/src/app/import/import.service.ts@@ -104,6 +104,12 @@ export class ImportService {`orders.${index}.symbol ("${symbol}") is not valid for the specified data source ("${dataSource}")`);}++ if (result[symbol].currency !== currency) {+ throw new Error(+ `orders.${index}.currency ("${currency}") does not match with "${result[symbol].currency}"`+ );+ }}}}diff --git a/test/import/invalid-currency.csv b/test/import/invalid-currency.csvnew file mode 100644index 0000000000..e04db317b3--- /dev/null+++ b/test/import/invalid-currency.csv@@ -0,0 +1,2 @@+Date,Code,Currency,Price,Quantity,Action,Fee+12/12/2021,BTC,EUR,44558.42,1,buy,0