From c8882ae6a18188a9c98a237dd594548ebac6f460 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 17 Mar 2021 19:33:44 +0100 Subject: [PATCH] =?UTF-8?q?Removed=20duplicate=20openapi=20declarations=20?= =?UTF-8?q?=F0=9F=97=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #160 --- src/controllers/ScanController.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/controllers/ScanController.ts b/src/controllers/ScanController.ts index b166d13..210cde1 100644 --- a/src/controllers/ScanController.ts +++ b/src/controllers/ScanController.ts @@ -16,6 +16,7 @@ import { ResponseEmpty } from '../models/responses/ResponseEmpty'; import { ResponseScan } from '../models/responses/ResponseScan'; import { ResponseTrackScan } from '../models/responses/ResponseTrackScan'; @JsonController('/scans') +@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) export class ScanController { private scanRepository: Repository; private trackScanRepository: Repository; @@ -32,7 +33,7 @@ export class ScanController { @Authorized("SCAN:GET") @ResponseSchema(ResponseScan, { isArray: true }) @ResponseSchema(ResponseTrackScan, { isArray: true }) - @OpenAPI({ description: 'Lists all scans (normal or track) from all runners.
This includes the scan\'s runner\'s distance ran.', security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) + @OpenAPI({ description: 'Lists all scans (normal or track) from all runners.
This includes the scan\'s runner\'s distance ran.' }) async getAll() { let responseScans: ResponseScan[] = new Array(); const scans = await this.scanRepository.find({ relations: ['runner', 'track', 'runner.scans', 'runner.group', 'runner.scans.track', 'card', 'station'] }); @@ -48,7 +49,7 @@ export class ScanController { @ResponseSchema(ResponseTrackScan) @ResponseSchema(ScanNotFoundError, { statusCode: 404 }) @OnUndefined(ScanNotFoundError) - @OpenAPI({ description: 'Lists all information about the scan whose id got provided. This includes the scan\'s runner\'s distance ran.', security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) + @OpenAPI({ description: 'Lists all information about the scan whose id got provided. This includes the scan\'s runner\'s distance ran.' }) async getOne(@Param('id') id: number) { let scan = await this.scanRepository.findOne({ id: id }, { relations: ['runner', 'track', 'runner.scans', 'runner.group', 'runner.scans.track', 'card', 'station'] }) if (!scan) { throw new ScanNotFoundError(); } @@ -87,7 +88,7 @@ export class ScanController { @ResponseSchema(ScanNotFoundError, { statusCode: 404 }) @ResponseSchema(RunnerNotFoundError, { statusCode: 404 }) @ResponseSchema(ScanIdsNotMatchingError, { statusCode: 406 }) - @OpenAPI({ description: "Update the scan (not track scan use /scans/trackscans/:id instead) whose id you provided.
Please remember that ids can't be changed and distances must be positive.", security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) + @OpenAPI({ description: "Update the scan (not track scan use /scans/trackscans/:id instead) whose id you provided.
Please remember that ids can't be changed and distances must be positive." }) async put(@Param('id') id: number, @Body({ validate: true }) scan: UpdateScan) { let oldScan = await this.scanRepository.findOne({ id: id }); @@ -110,7 +111,7 @@ export class ScanController { @ResponseSchema(RunnerNotFoundError, { statusCode: 404 }) @ResponseSchema(ScanStationNotFoundError, { statusCode: 404 }) @ResponseSchema(ScanIdsNotMatchingError, { statusCode: 406 }) - @OpenAPI({ description: 'Update the track scan (not "normal" scan use /scans/trackscans/:id instead) whose id you provided.
Please remember that only the validity, runner and track can be changed.', security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) + @OpenAPI({ description: 'Update the track scan (not "normal" scan use /scans/trackscans/:id instead) whose id you provided.
Please remember that only the validity, runner and track can be changed.' }) async putTrackScan(@Param('id') id: number, @Body({ validate: true }) scan: UpdateTrackScan) { let oldScan = await this.trackScanRepository.findOne({ id: id }); @@ -131,7 +132,7 @@ export class ScanController { @ResponseSchema(ResponseScan) @ResponseSchema(ResponseEmpty, { statusCode: 204 }) @OnUndefined(204) - @OpenAPI({ description: 'Delete the scan whose id you provided.
If no scan with this id exists it will just return 204(no content).', security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) + @OpenAPI({ description: 'Delete the scan whose id you provided.
If no scan with this id exists it will just return 204(no content).' }) async remove(@Param("id") id: number, @QueryParam("force") force: boolean) { let scan = await this.scanRepository.findOne({ id: id }); if (!scan) { return null; }