Bugfix/fix activities import with account balances (#4446)

* Fix import with account balances

* Update changelog
This commit is contained in:
Thomas Kaul
2025-03-17 22:27:22 +01:00
committed by GitHub
parent 51d55f74e9
commit 4db8c007f0
6 changed files with 27 additions and 4 deletions

View File

@@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the symbol validation in the _Yahoo Finance_ service (get asset profiles) - Improved the symbol validation in the _Yahoo Finance_ service (get asset profiles)
- Refreshed the cryptocurrencies list - Refreshed the cryptocurrencies list
### Fixed
- Fixed an issue in the activities import functionality related to the account balances
## 2.146.0 - 2025-03-15 ## 2.146.0 - 2025-03-15
### Changed ### Changed

View File

@@ -0,0 +1,10 @@
import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto';
import { AccountBalance } from '@ghostfolio/common/interfaces';
import { IsArray, IsOptional } from 'class-validator';
export class CreateAccountWithBalancesDto extends CreateAccountDto {
@IsArray()
@IsOptional()
balances?: AccountBalance;
}

View File

@@ -1,15 +1,16 @@
import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto';
import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto'; import { CreateOrderDto } from '@ghostfolio/api/app/order/create-order.dto';
import { Type } from 'class-transformer'; import { Type } from 'class-transformer';
import { IsArray, IsOptional, ValidateNested } from 'class-validator'; import { IsArray, IsOptional, ValidateNested } from 'class-validator';
import { CreateAccountWithBalancesDto } from './create-account-with-balances.dto';
export class ImportDataDto { export class ImportDataDto {
@IsOptional() @IsOptional()
@IsArray() @IsArray()
@Type(() => CreateAccountDto) @Type(() => CreateAccountWithBalancesDto)
@ValidateNested({ each: true }) @ValidateNested({ each: true })
accounts: CreateAccountDto[]; accounts: CreateAccountWithBalancesDto[];
@IsArray() @IsArray()
@Type(() => CreateOrderDto) @Type(() => CreateOrderDto)

View File

@@ -0,0 +1,4 @@
export interface AccountBalance {
date: string;
value: number;
}

View File

@@ -1,8 +1,10 @@
import { Account, Order, Platform, Tag } from '@prisma/client'; import { Account, Order, Platform, Tag } from '@prisma/client';
import { AccountBalance } from './account-balance.interface';
export interface Export { export interface Export {
accounts: (Omit<Account, 'createdAt' | 'updatedAt' | 'userId'> & { accounts: (Omit<Account, 'createdAt' | 'updatedAt' | 'userId'> & {
balances: { date: string; value: number }[]; balances: AccountBalance[];
})[]; })[];
activities: (Omit< activities: (Omit<
Order, Order,

View File

@@ -1,4 +1,5 @@
import type { Access } from './access.interface'; import type { Access } from './access.interface';
import type { AccountBalance } from './account-balance.interface';
import type { Accounts } from './accounts.interface'; import type { Accounts } from './accounts.interface';
import type { AdminData } from './admin-data.interface'; import type { AdminData } from './admin-data.interface';
import type { AdminJobs } from './admin-jobs.interface'; import type { AdminJobs } from './admin-jobs.interface';
@@ -68,6 +69,7 @@ import type { XRayRulesSettings } from './x-ray-rules-settings.interface';
export { export {
Access, Access,
AccountBalance,
AccountBalancesResponse, AccountBalancesResponse,
Accounts, Accounts,
AdminData, AdminData,