Refactoring (#1545)

pull/1551/head
Thomas Kaul 2 years ago committed by GitHub
parent e8d65e1c85
commit 66d5793528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,7 +18,6 @@ import {
PortfolioPublicDetails,
PortfolioReport
} from '@ghostfolio/common/interfaces';
import { InvestmentItem } from '@ghostfolio/common/interfaces/investment-item.interface';
import type {
DateRange,
GroupBy,
@ -193,20 +192,11 @@ export class PortfolioController {
@Query('range') dateRange: DateRange = 'max',
@Query('groupBy') groupBy?: GroupBy
): Promise<PortfolioDividends> {
let dividends: InvestmentItem[];
if (groupBy === 'month') {
dividends = await this.portfolioService.getDividends({
dateRange,
groupBy,
impersonationId
});
} else {
dividends = await this.portfolioService.getDividends({
dateRange,
impersonationId
});
}
let dividends = await this.portfolioService.getDividends({
dateRange,
groupBy,
impersonationId
});
if (
impersonationId ||
@ -242,20 +232,11 @@ export class PortfolioController {
@Query('range') dateRange: DateRange = 'max',
@Query('groupBy') groupBy?: GroupBy
): Promise<PortfolioInvestments> {
let investments: InvestmentItem[];
if (groupBy === 'month') {
investments = await this.portfolioService.getInvestments({
dateRange,
groupBy,
impersonationId
});
} else {
investments = await this.portfolioService.getInvestments({
dateRange,
impersonationId
});
}
let investments = await this.portfolioService.getInvestments({
dateRange,
groupBy,
impersonationId
});
if (
impersonationId ||

@ -210,12 +210,12 @@ export class PortfolioService {
public async getDividends({
dateRange,
impersonationId,
groupBy
groupBy,
impersonationId
}: {
dateRange: DateRange;
impersonationId: string;
groupBy?: GroupBy;
impersonationId: string;
}): Promise<InvestmentItem[]> {
const userId = await this.getUserId(impersonationId, this.request.user.id);
@ -248,12 +248,12 @@ export class PortfolioService {
public async getInvestments({
dateRange,
impersonationId,
groupBy
groupBy,
impersonationId
}: {
dateRange: DateRange;
impersonationId: string;
groupBy?: GroupBy;
impersonationId: string;
}): Promise<InvestmentItem[]> {
const userId = await this.getUserId(impersonationId, this.request.user.id);

Loading…
Cancel
Save