@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user