refactor: organize backend by business responsibility
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Controller, Get, Param, Req, UseGuards } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
||||
import type { Request } from 'express';
|
||||
import { ApiProblemResponses } from '../../../../common/decorators/api-safe-error-response.decorator';
|
||||
import { AccessPayload, JwtAuthGuard } from '../../../auth/auth.api';
|
||||
import { PortfolioDto } from './portfolio.dto';
|
||||
import { PortfolioService } from '../application/portfolio.service';
|
||||
|
||||
@ApiTags('brokerage-accounts')
|
||||
@ApiProblemResponses()
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Controller('brokerage-accounts')
|
||||
export class PortfolioController {
|
||||
constructor(private readonly portfolio: PortfolioService) {}
|
||||
|
||||
@Get('all/portfolio')
|
||||
@ApiOkResponse({ type: PortfolioDto })
|
||||
all(@Req() request: Request & { user: AccessPayload }) {
|
||||
return this.portfolio.getAll(request.user.sub);
|
||||
}
|
||||
|
||||
@Get(':accountId/portfolio')
|
||||
@ApiOkResponse({ type: PortfolioDto })
|
||||
get(
|
||||
@Req() request: Request & { user: AccessPayload },
|
||||
@Param('accountId') accountId: string,
|
||||
) {
|
||||
return this.portfolio.get(request.user.sub, accountId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user