import { Controller, Get, Param, Req, UseGuards } from '@nestjs/common'; import { ApiBearerAuth, ApiOkResponse, ApiTags } from '@nestjs/swagger'; import type { Request } from 'express'; import { AccessPayload } from '../auth/auth.types'; import { JwtAuthGuard } from '../auth/jwt-auth.guard'; import { ApiProblemResponses } from '../common/decorators/api-safe-error-response.decorator'; import { UpcomingEventsDto } from './upcoming-events.dto'; import { UpcomingEventsService } from './upcoming-events.service'; @ApiTags('brokerage-accounts') @ApiProblemResponses() @ApiBearerAuth() @UseGuards(JwtAuthGuard) @Controller('brokerage-accounts') export class UpcomingEventsController { constructor(private readonly events: UpcomingEventsService) {} @Get(':accountId/events') @ApiOkResponse({ type: UpcomingEventsDto }) get( @Req() request: Request & { user: AccessPayload }, @Param('accountId') accountId: string, ) { return this.events.get(request.user.sub, accountId); } }