Created a barebones pdf controller

ref #3
This commit is contained in:
Nicolai Ort 2021-02-02 11:28:24 +01:00
parent 3ca38abe93
commit 64bd1ffc3a
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { ContentType, Controller, Get } from 'routing-controllers';
import { OpenAPI } from 'routing-controllers-openapi';
import { PdfCreator } from '../PdfCreator';
@Controller()
export class PdfController {
private pdf: PdfCreator;
constructor() {
this.pdf = new PdfCreator();
}
@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();
return await this.pdf.toBuffer(contracts);
}
}