Expanded API Decriptions

ref #22
This commit is contained in:
Nicolai Ort 2020-12-17 19:15:11 +01:00
parent 03b7e346ab
commit 9db4344153
1 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ export class ImportController {
@Post('/runners/import')
@ContentType("application/json")
@OpenAPI({ description: "Create new runners from json" })
@OpenAPI({ description: "Create new runners from json and insert them (or their teams) into the provided group" })
async postJSON(@Body({ validate: true, type: ImportRunner }) importRunners: ImportRunner[], @QueryParam("group") groupID: number) {
if (!groupID) { throw new RunnerGroupNeededError(); }
let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
@ -33,21 +33,21 @@ export class ImportController {
@Post('/organisations/:id/import')
@ContentType("application/json")
@OpenAPI({ description: "Create new runners from json" })
@OpenAPI({ description: "Create new runners from json and insert them (or their teams) into the provided org" })
async postOrgsJSON(@Body({ validate: true, type: ImportRunner }) importRunners: ImportRunner[], @Param('id') id: number) {
return await this.postJSON(importRunners, id)
}
@Post('/teams/:id/import')
@ContentType("application/json")
@OpenAPI({ description: "Create new runners from json" })
@OpenAPI({ description: "Create new runners from json and insert them into the provided team" })
async postTeamsJSON(@Body({ validate: true, type: ImportRunner }) importRunners: ImportRunner[], @Param('id') id: number) {
return await this.postJSON(importRunners, id)
}
@Post('/import/csv')
@UseBefore(RawBodyMiddleware)
@OpenAPI({ description: "Create new runners from csv" })
@OpenAPI({ description: "Create new runners from csv and insert them (or their teams) into the provided group" })
async postCSV(@Req() request: any, @QueryParam("group") groupID: number) {
let csvParse = await csv({ delimiter: [",", ";"], trim: true }).fromString(request.rawBody.toString());
let importRunners: ImportRunner[] = new Array<ImportRunner>();
@ -65,14 +65,14 @@ export class ImportController {
@Post('/organisations/:id/import/csv')
@UseBefore(RawBodyMiddleware)
@OpenAPI({ description: "Create new runners from csv" })
@OpenAPI({ description: "Create new runners from csv and insert them (or their teams) into the provided org" })
async postOrgsCSV(@Req() request: any, @Param("id") id: number) {
return await this.postCSV(request, id);
}
@Post('/teams/:id/import/csv')
@UseBefore(RawBodyMiddleware)
@OpenAPI({ description: "Create new runners from csv" })
@OpenAPI({ description: "Create new runners from csv and insert them into the provided team" })
async postTeamsCSV(@Req() request: any, @Param("id") id: number) {
return await this.postCSV(request, id);
}