parent
f833ae222e
commit
cd51e78282
|
@ -3,6 +3,11 @@ import { OpenAPI } from 'routing-controllers-openapi';
|
|||
import { Runner } from '../models/Runner';
|
||||
import { PdfCreator } from '../PdfCreator';
|
||||
|
||||
/**
|
||||
* The pdf controller handels all endpoints concerning pdf generation.
|
||||
* It therefore is the hearth of the document-generation server's endpoints.
|
||||
* All endpoints have to accept a locale query-param to support i18n.
|
||||
*/
|
||||
@JsonController()
|
||||
export class PdfController {
|
||||
private pdf: PdfCreator;
|
||||
|
@ -11,10 +16,10 @@ export class PdfController {
|
|||
}
|
||||
|
||||
@Post('/contracts')
|
||||
@OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects." })
|
||||
@OpenAPI({ description: "Generate Sponsoring contract pdfs from runner objects.<br>You can choose your prefered locale by passing the 'locale' query-param." })
|
||||
async generateContracts(@Body({ validate: true }) runners: Runner | Runner[], @Res() res: any, @QueryParam("locale") locale: string) {
|
||||
if (!Array.isArray(runners)) {
|
||||
runners = [runners]
|
||||
runners = [runners];
|
||||
}
|
||||
const contracts = await this.pdf.generateSponsoringContract(runners, locale);
|
||||
res.setHeader('content-type', 'application/pdf');
|
||||
|
|
|
@ -2,6 +2,9 @@ import { Get, JsonController } from 'routing-controllers';
|
|||
import { OpenAPI } from 'routing-controllers-openapi';
|
||||
import { config } from '../config';
|
||||
|
||||
/**
|
||||
* The statuscontroller provides simple endpoints concerning basic information about the server.
|
||||
*/
|
||||
@JsonController()
|
||||
export class StatusController {
|
||||
@Get('/version')
|
||||
|
|
Loading…
Reference in New Issue