|
|
@ -47,6 +47,7 @@ import { StatusCodes, getReasonPhrase } from 'http-status-codes'; |
|
|
|
import { PortfolioPositionDetail } from './interfaces/portfolio-position-detail.interface'; |
|
|
|
import { PortfolioPositions } from './interfaces/portfolio-positions.interface'; |
|
|
|
import { PortfolioService } from './portfolio.service'; |
|
|
|
import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; |
|
|
|
|
|
|
|
@Controller('portfolio') |
|
|
|
export class PortfolioController { |
|
|
@ -61,7 +62,7 @@ export class PortfolioController { |
|
|
|
) {} |
|
|
|
|
|
|
|
@Get('details') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
public async getDetails( |
|
|
@ -204,7 +205,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@Get('dividends') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async getDividends( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Query('accounts') filterByAccounts?: string, |
|
|
@ -254,7 +255,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@Get('investments') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async getInvestments( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Query('accounts') filterByAccounts?: string, |
|
|
@ -315,7 +316,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@Get('performance') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
@Version('2') |
|
|
|
public async getPerformanceV2( |
|
|
@ -405,7 +406,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@Get('positions') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
public async getPositions( |
|
|
@ -500,7 +501,7 @@ export class PortfolioController { |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInRequestInterceptor) |
|
|
|
@UseInterceptors(TransformDataSourceInResponseInterceptor) |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async getPosition( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Param('dataSource') dataSource, |
|
|
@ -523,7 +524,7 @@ export class PortfolioController { |
|
|
|
} |
|
|
|
|
|
|
|
@Get('report') |
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
public async getReport( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string |
|
|
|
): Promise<PortfolioReport> { |
|
|
|