From 965d0251bb84d9b964173f0ccb2298e41dc99a3e Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Thu, 26 Nov 2026 11:53:43 +0000 Subject: [PATCH] refactor(api): address PR review feedback on import service --- apps/api/src/services/import/import.service.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/api/src/services/import/import.service.ts b/apps/api/src/services/import/import.service.ts index 95f6021c16..cd4d865fb7 100644 --- a/apps/api/src/services/import/import.service.ts +++ b/apps/api/src/services/import/import.service.ts @@ -182,12 +182,13 @@ export class ImportService { date, error, quantity, + userId, value, accountId: account?.id ?? null, accountUserId: null, comment: null, currency: null, - createdAt: date, + createdAt: new Date(), fee: 0, feeInAssetProfileCurrency: 0, feeInBaseCurrency: 0, @@ -196,8 +197,7 @@ export class ImportService { type: 'DIVIDEND' as ActivityType, unitPrice: marketPrice, unitPriceInAssetProfileCurrency: marketPrice, - updatedAt: date, - userId: account?.userId ?? '', + updatedAt: new Date(), valueInBaseCurrency: value } ]; @@ -986,6 +986,12 @@ export class ImportService { assetProfile.symbol ?? activity.assetProfile.symbol; + if (!assetProfile.currency) { + throw new ImportValidationError( + `Asset profile ("${symbol}") has no currency` + ); + } + const createdActivity = await this.activitiesService.createActivity({ comment, currency, @@ -1001,7 +1007,7 @@ export class ImportService { dataSource, name, symbol, - currency: assetProfile.currency ?? currency, + currency: assetProfile.currency, userId: dataSource === 'MANUAL' ? user.id : undefined }, where: {