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