Added comments

ref #5
This commit is contained in:
Nicolai Ort 2021-02-05 22:02:26 +01:00
parent f833ae222e
commit cd51e78282
2 changed files with 10 additions and 2 deletions

View File

@ -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');

View File

@ -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')