Merge branch 'dev' into feature/112-selfservice_registration
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/pr Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/pr Build is passing
				
			This commit is contained in:
		@@ -8,6 +8,8 @@ import { UpdateRunner } from '../models/actions/update/UpdateRunner';
 | 
			
		||||
import { Runner } from '../models/entities/Runner';
 | 
			
		||||
import { ResponseEmpty } from '../models/responses/ResponseEmpty';
 | 
			
		||||
import { ResponseRunner } from '../models/responses/ResponseRunner';
 | 
			
		||||
import { ResponseScan } from '../models/responses/ResponseScan';
 | 
			
		||||
import { ResponseTrackScan } from '../models/responses/ResponseTrackScan';
 | 
			
		||||
import { DonationController } from './DonationController';
 | 
			
		||||
import { RunnerCardController } from './RunnerCardController';
 | 
			
		||||
import { ScanController } from './ScanController';
 | 
			
		||||
@@ -49,6 +51,31 @@ export class RunnerController {
 | 
			
		||||
		return new ResponseRunner(runner);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Get('/:id/scans')
 | 
			
		||||
	@Authorized(["RUNNER:GET", "SCAN:GET"])
 | 
			
		||||
	@ResponseSchema(ResponseScan, { isArray: true })
 | 
			
		||||
	@ResponseSchema(ResponseTrackScan, { isArray: true })
 | 
			
		||||
	@ResponseSchema(RunnerNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OpenAPI({ description: 'Lists all scans of the runner whose id got provided. <br> If you only want the valid scans just add the ?onlyValid=true query param.' })
 | 
			
		||||
	async getScans(@Param('id') id: number, onlyValid?: boolean) {
 | 
			
		||||
		let responseScans: ResponseScan[] = new Array<ResponseScan>();
 | 
			
		||||
		let runner = await this.runnerRepository.findOne({ id: id }, { relations: ['scans', 'scans.track', 'scans.station', 'scans.runner'] })
 | 
			
		||||
		if (!runner) { throw new RunnerNotFoundError(); }
 | 
			
		||||
 | 
			
		||||
		if (!onlyValid) {
 | 
			
		||||
			for (let scan of runner.scans) {
 | 
			
		||||
				responseScans.push(scan.toResponse());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			for (let scan of runner.validScans) {
 | 
			
		||||
				responseScans.push(scan.toResponse());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return responseScans;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Post()
 | 
			
		||||
	@Authorized("RUNNER:CREATE")
 | 
			
		||||
	@ResponseSchema(ResponseRunner)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user