init
This commit is contained in:
21
server/src/modules/downloads/downloads.controller.ts
Normal file
21
server/src/modules/downloads/downloads.controller.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user