Abstracted a little bit more for potential company runner import
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user