import type { Request } from 'express'; import { Controller, Get, Param, Req, UseGuards } from '@nestjs/common'; import { ApiBearerAuth, ApiExtraModels, ApiOkResponse, ApiTags, } from '@nestjs/swagger'; import { ApiProblemResponses } from '../../../common/decorators/api-safe-error-response.decorator'; import { AccessPayload, JwtAuthGuard } from '../../auth/auth.api'; import { EventsInvestmentScreenDto, IncomeInvestmentScreenDto, TbankSyncStatusDto, TimestampInvestmentScreenDto, } from './tbank-sync.dto'; import { TbankSyncService } from './tbank-sync.service'; @ApiTags('tbank-sync') @ApiExtraModels( EventsInvestmentScreenDto, IncomeInvestmentScreenDto, TimestampInvestmentScreenDto, TbankSyncStatusDto, ) @ApiProblemResponses() @ApiBearerAuth() @UseGuards(JwtAuthGuard) @Controller('tbank-sync') export class TbankSyncController { constructor(private readonly sync: TbankSyncService) {} @Get(':id') @ApiOkResponse({ type: TbankSyncStatusDto }) status( @Req() request: Request & { user: AccessPayload }, @Param('id') id: string, ) { return this.sync.status(request.user.sub, id); } }