parent
96d863bfc8
commit
bd6ec6215d
|
@ -1,8 +1,8 @@
|
|||
import { ContentType, Controller, Get } from 'routing-controllers';
|
||||
import { Body, Get, JsonController, Res } from 'routing-controllers';
|
||||
import { OpenAPI } from 'routing-controllers-openapi';
|
||||
import { PdfCreator } from '../PdfCreator';
|
||||
|
||||
@Controller()
|
||||
@JsonController()
|
||||
export class PdfController {
|
||||
private pdf: PdfCreator;
|
||||
constructor() {
|
||||
|
@ -10,11 +10,10 @@ export class PdfController {
|
|||
}
|
||||
|
||||
@Get('/contracts')
|
||||
@ContentType("application/pdf")
|
||||
@OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects." })
|
||||
async generateContracts() {
|
||||
//TODO: Accept the real classes
|
||||
const contracts = await this.pdf.generateSponsoringContract();
|
||||
async generateContracts(@Body({ validate: true }) runner: any, @Res() res: any) {
|
||||
const contracts = await this.pdf.generateSponsoringContract(runner);
|
||||
res.setHeader('content-type', 'application/pdf');
|
||||
return await contracts;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue