Skip to content

Commit 4db8c00

Browse files
authored
Bugfix/fix activities import with account balances (ghostfolio#4446)
* Fix import with account balances * Update changelog
1 parent 51d55f7 commit 4db8c00

File tree

6 files changed

+27
-4
lines changed

6 files changed

+27
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Improved the symbol validation in the _Yahoo Finance_ service (get asset profiles)
1313
- Refreshed the cryptocurrencies list
1414

15+
### Fixed
16+
17+
- Fixed an issue in the activities import functionality related to the account balances
18+
1519
## 2.146.0 - 2025-03-15
1620

1721
### Changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto';
2+
import { AccountBalance } from '@ghostfolio/common/interfaces';
3+
4+
import { IsArray, IsOptional } from 'class-validator';
5+
6+
export class CreateAccountWithBalancesDto extends CreateAccountDto {
7+
@IsArray()
8+
@IsOptional()
9+
balances?: AccountBalance;
10+
}

apps/api/src/app/import/import-data.dto.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto';
21
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
32

43
import { Type } from 'class-transformer';
54
import { IsArray, IsOptional, ValidateNested } from 'class-validator';
65

6+
import { CreateAccountWithBalancesDto } from './create-account-with-balances.dto';
7+
78
export class ImportDataDto {
89
@IsOptional()
910
@IsArray()
10-
@Type(() => CreateAccountDto)
11+
@Type(() => CreateAccountWithBalancesDto)
1112
@ValidateNested({ each: true })
12-
accounts: CreateAccountDto[];
13+
accounts: CreateAccountWithBalancesDto[];
1314

1415
@IsArray()
1516
@Type(() => CreateOrderDto)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface AccountBalance {
2+
date: string;
3+
value: number;
4+
}

libs/common/src/lib/interfaces/export.interface.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { Account, Order, Platform, Tag } from '@prisma/client';
22

3+
import { AccountBalance } from './account-balance.interface';
4+
35
export interface Export {
46
accounts: (Omit<Account, 'createdAt' | 'updatedAt' | 'userId'> & {
5-
balances: { date: string; value: number }[];
7+
balances: AccountBalance[];
68
})[];
79
activities: (Omit<
810
Order,

libs/common/src/lib/interfaces/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Access } from './access.interface';
2+
import type { AccountBalance } from './account-balance.interface';
23
import type { Accounts } from './accounts.interface';
34
import type { AdminData } from './admin-data.interface';
45
import type { AdminJobs } from './admin-jobs.interface';
@@ -68,6 +69,7 @@ import type { XRayRulesSettings } from './x-ray-rules-settings.interface';
6869

6970
export {
7071
Access,
72+
AccountBalance,
7173
AccountBalancesResponse,
7274
Accounts,
7375
AdminData,

0 commit comments

Comments
 (0)