diff --git a/CHANGELOG.md b/CHANGELOG.md index 387ebb8ba..9db53d78e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed the fallback to load currencies directly from the data provider +- Fixed the missing symbol profile data connection in the import functionality for activities ## 1.103.0 - 13.01.2022 diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index b17404ae9..6bf936137 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -34,11 +34,6 @@ export class ImportService { unitPrice } of orders) { await this.orderService.createOrder({ - Account: { - connect: { - id_userId: { userId, id: accountId } - } - }, currency, dataSource, fee, @@ -46,7 +41,26 @@ export class ImportService { symbol, type, unitPrice, + Account: { + connect: { + id_userId: { userId, id: accountId } + } + }, date: parseISO((date)), + SymbolProfile: { + connectOrCreate: { + create: { + dataSource, + symbol + }, + where: { + dataSource_symbol: { + dataSource, + symbol + } + } + } + }, User: { connect: { id: userId } } }); } diff --git a/apps/api/src/app/order/order.controller.ts b/apps/api/src/app/order/order.controller.ts index da1c44c95..052138e62 100644 --- a/apps/api/src/app/order/order.controller.ts +++ b/apps/api/src/app/order/order.controller.ts @@ -116,23 +116,23 @@ export class OrderController { return this.orderService.createOrder({ ...data, + date, Account: { connect: { id_userId: { id: accountId, userId: this.request.user.id } } }, - date, SymbolProfile: { connectOrCreate: { + create: { + dataSource: data.dataSource, + symbol: data.symbol + }, where: { dataSource_symbol: { dataSource: data.dataSource, symbol: data.symbol } - }, - create: { - dataSource: data.dataSource, - symbol: data.symbol } } },