Abstracted a little bit more for potential company runner import

This commit is contained in:
2020-12-17 16:32:29 +01:00
parent cad30c7f63
commit 1b59d58c60
3 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
import { Body, ContentType, Controller, Post, Req, UseBefore } from 'routing-controllers';
import { OpenAPI } from 'routing-controllers-openapi';
import RawBodyMiddleware from '../middlewares/RawBody';
import { ImportRunner } from '../models/actions/ImportRunner';
import { ImportSchoolRunner } from '../models/actions/ImportSchoolRunner';
import { ResponseRunner } from '../models/responses/ResponseRunner';
import { RunnerController } from './RunnerController';
@@ -20,7 +21,7 @@ export class ImportController {
@Post('/runners/import')
@ContentType("application/json")
@OpenAPI({ description: "Create new runners from json" })
async postJSON(@Body({ validate: true, type: ImportSchoolRunner }) importRunners: ImportSchoolRunner[]) {
async postJSON(@Body({ validate: true, type: ImportSchoolRunner }) importRunners: ImportRunner[]) {
let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
for await (let runner of importRunners) {
responseRunners.push(await this.runnerController.post(await runner.toCreateRunner(1)));