Added alias for posting track scans

ref #67
This commit is contained in:
Nicolai Ort 2021-01-07 19:46:20 +01:00
parent 4f01baaa23
commit 7387f700fb
1 changed files with 9 additions and 1 deletions

View File

@ -54,12 +54,20 @@ export class ScanController {
@Authorized("SCAN:CREATE")
@ResponseSchema(ResponseScan)
@OpenAPI({ description: 'Create a new runner. <br> Please remeber to provide the runner\'s group\'s id.' })
async post(@Body({ validate: true }) createScan: CreateScan | CreateTrackScan) {
async post(@Body({ validate: true }) createScan: CreateScan) {
let scan = await createScan.toScan();
scan = await this.scanRepository.save(scan);
return (await this.scanRepository.findOne({ id: scan.id }, { relations: ['runner'] })).toResponse();
}
@Post("/trackscans")
@Authorized("SCAN:CREATE")
@ResponseSchema(ResponseScan)
@OpenAPI({ description: 'Create a new track scan. <br> This is just a alias for posting /scans' })
async postTrackScans(@Body({ validate: true }) createScan: CreateTrackScan) {
return this.post(createScan);
}
@Put('/:id')
@Authorized("SCAN:UPDATE")
@ResponseSchema(ResponseScan)