import { Controller, Get, Param, Req, Res } from '@nestjs/common'; import { ApiOperation, ApiTags } from '@nestjs/swagger'; import type { Request, Response } from 'express'; import type { RequestWithContext } from '../../common/interfaces/request-with-context.interface'; import { DownloadsService } from './downloads.service'; @ApiTags('public-downloads') @Controller('downloads') export class DownloadsController { constructor(private readonly downloadsService: DownloadsService) {} @Get(':ticket') @ApiOperation({ summary: 'Consume ticket and stream artifact file' }) async consumeTicket( @Param('ticket') ticket: string, @Req() request: Request, @Res() response: Response, ) { await this.downloadsService.consumeTicketAndStream(ticket, request as RequestWithContext, response); } }