feat: add hourly portfolio sync history
This commit is contained in:
@@ -1,22 +1,8 @@
|
||||
import type { Request } from 'express';
|
||||
|
||||
import { Controller, Get, Param, Req, UseGuards } from '@nestjs/common';
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
HttpCode,
|
||||
HttpStatus,
|
||||
Param,
|
||||
Post,
|
||||
Req,
|
||||
UseGuards,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
ApiAcceptedResponse,
|
||||
ApiBearerAuth,
|
||||
ApiBody,
|
||||
ApiExtraModels,
|
||||
ApiOkResponse,
|
||||
ApiTags,
|
||||
@@ -27,9 +13,6 @@ import { AccessPayload, JwtAuthGuard } from '../../auth/auth.api';
|
||||
import {
|
||||
EventsInvestmentScreenDto,
|
||||
IncomeInvestmentScreenDto,
|
||||
InvestmentScreenDto,
|
||||
investmentScreenSchema,
|
||||
TbankSyncAcceptedDto,
|
||||
TbankSyncStatusDto,
|
||||
TimestampInvestmentScreenDto,
|
||||
} from './tbank-sync.dto';
|
||||
@@ -37,9 +20,10 @@ import { TbankSyncService } from './tbank-sync.service';
|
||||
|
||||
@ApiTags('tbank-sync')
|
||||
@ApiExtraModels(
|
||||
IncomeInvestmentScreenDto,
|
||||
EventsInvestmentScreenDto,
|
||||
IncomeInvestmentScreenDto,
|
||||
TimestampInvestmentScreenDto,
|
||||
TbankSyncStatusDto,
|
||||
)
|
||||
@ApiProblemResponses()
|
||||
@ApiBearerAuth()
|
||||
@@ -47,28 +31,6 @@ import { TbankSyncService } from './tbank-sync.service';
|
||||
@Controller('tbank-sync')
|
||||
export class TbankSyncController {
|
||||
constructor(private readonly sync: TbankSyncService) {}
|
||||
@Post()
|
||||
@HttpCode(HttpStatus.ACCEPTED)
|
||||
@ApiBody({ schema: investmentScreenSchema })
|
||||
@ApiAcceptedResponse({ type: TbankSyncAcceptedDto })
|
||||
request(
|
||||
@Req() request: Request & { user: AccessPayload },
|
||||
@Body(
|
||||
new ValidationPipe({
|
||||
forbidUnknownValues: true,
|
||||
expectedType: InvestmentScreenDto,
|
||||
transform: true,
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
validationError: { target: false, value: false },
|
||||
exceptionFactory: (message) => new BadRequestException({ message }),
|
||||
}),
|
||||
)
|
||||
input: unknown,
|
||||
) {
|
||||
return this.sync.request(request.user.sub, input as InvestmentScreenDto);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@ApiOkResponse({ type: TbankSyncStatusDto })
|
||||
status(
|
||||
|
||||
Reference in New Issue
Block a user