Feature/validate account balance creation/update using DTO (#3400)
* Validate create account balance using DTO
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { CreateAccountBalanceDto } from '@ghostfolio/api/app/account-balance/create-account-balance.dto';
|
||||
import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interface';
|
||||
import { DataService } from '@ghostfolio/client/services/data.service';
|
||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||
@@ -95,19 +96,9 @@ export class AccountDetailDialog implements OnDestroy, OnInit {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public onAddAccountBalance({
|
||||
balance,
|
||||
date
|
||||
}: {
|
||||
balance: number;
|
||||
date: Date;
|
||||
}) {
|
||||
public onAddAccountBalance(accountBalance: CreateAccountBalanceDto) {
|
||||
this.dataService
|
||||
.postAccountBalance({
|
||||
balance,
|
||||
date,
|
||||
accountId: this.data.accountId
|
||||
})
|
||||
.postAccountBalance(accountBalance)
|
||||
.pipe(takeUntil(this.unsubscribeSubject))
|
||||
.subscribe(() => {
|
||||
this.fetchAccount();
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { CreateAccessDto } from '@ghostfolio/api/app/access/create-access.dto';
|
||||
import { CreateAccountBalanceDto } from '@ghostfolio/api/app/account-balance/create-account-balance.dto';
|
||||
import { CreateAccountDto } from '@ghostfolio/api/app/account/create-account.dto';
|
||||
import { TransferBalanceDto } from '@ghostfolio/api/app/account/transfer-balance.dto';
|
||||
import { UpdateAccountDto } from '@ghostfolio/api/app/account/update-account.dto';
|
||||
@@ -601,20 +602,11 @@ export class DataService {
|
||||
return this.http.post<OrderModel>(`/api/v1/account`, aAccount);
|
||||
}
|
||||
|
||||
public postAccountBalance({
|
||||
accountId,
|
||||
balance,
|
||||
date
|
||||
}: {
|
||||
accountId: string;
|
||||
balance: number;
|
||||
date: Date;
|
||||
}) {
|
||||
return this.http.post<AccountBalance>(`/api/v1/account-balance`, {
|
||||
accountId,
|
||||
balance,
|
||||
date
|
||||
});
|
||||
public postAccountBalance(aAccountBalance: CreateAccountBalanceDto) {
|
||||
return this.http.post<AccountBalance>(
|
||||
`/api/v1/account-balance`,
|
||||
aAccountBalance
|
||||
);
|
||||
}
|
||||
|
||||
public postBenchmark(benchmark: UniqueAsset) {
|
||||
|
Reference in New Issue
Block a user