Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/remove transactions import limit (#536)
Thomas Kauled7209fb53ca
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0b962f1f3b..09c8e6e48b 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+### Changed++- Removed the default transactions import limit+### Fixed- Fixed `/bin/sh: prisma: not found` in docker builddiff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.tsindex 59df401bdf..cf9f6f7058 100644--- a/apps/api/src/app/import/import.service.ts+++ b/apps/api/src/app/import/import.service.ts@@ -1,4 +1,5 @@import { OrderService } from '@ghostfolio/api/app/order/order.service';+import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';import { Injectable } from '@nestjs/common';import { Order } from '@prisma/client';@@ -6,9 +7,8 @@ import { isSameDay, parseISO } from 'date-fns';@Injectable()export class ImportService {- private static MAX_ORDERS_TO_IMPORT = 20;-public constructor(+ private readonly configurationService: ConfigurationService,private readonly dataProviderService: DataProviderService,private readonly orderService: OrderService) {}@@ -59,8 +59,14 @@ export class ImportService {orders: Partial<Order>[];userId: string;}) {- if (orders?.length > ImportService.MAX_ORDERS_TO_IMPORT) {- throw new Error('Too many transactions');+ if (+ orders?.length > this.configurationService.get('MAX_ORDERS_TO_IMPORT')+ ) {+ throw new Error(+ `Too many transactions (${this.configurationService.get(+ 'MAX_ORDERS_TO_IMPORT'+ )} at most)`+ );}const existingOrders = await this.orderService.orders({diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration.service.tsindex 1956a6b626..b2d9c65fba 100644--- a/apps/api/src/services/configuration.service.ts+++ b/apps/api/src/services/configuration.service.ts@@ -27,6 +27,7 @@ export class ConfigurationService {GOOGLE_SECRET: str({ default: 'dummySecret' }),JWT_SECRET_KEY: str({}),MAX_ITEM_IN_CACHE: num({ default: 9999 }),+ MAX_ORDERS_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),PORT: port({ default: 3333 }),RAKUTEN_RAPID_API_KEY: str({ default: '' }),REDIS_HOST: str({ default: 'localhost' }),diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.tsindex e475d32ec8..56f8fe822b 100644--- a/apps/api/src/services/interfaces/environment.interface.ts+++ b/apps/api/src/services/interfaces/environment.interface.ts@@ -18,6 +18,7 @@ export interface Environment extends CleanedEnvAccessors {GOOGLE_SECRET: string;JWT_SECRET_KEY: string;MAX_ITEM_IN_CACHE: number;+ MAX_ORDERS_TO_IMPORT: number;PORT: number;RAKUTEN_RAPID_API_KEY: string;REDIS_HOST: string;