@@ -1,6 +1,7 @@
 | 
			
		||||
import { Authorized, Get, JsonController } from 'routing-controllers';
 | 
			
		||||
import { Authorized, Get, JsonController, OnUndefined, Param } from 'routing-controllers';
 | 
			
		||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
 | 
			
		||||
import { getConnectionManager, Repository } from 'typeorm';
 | 
			
		||||
import { ScanStationNotFoundError } from '../errors/ScanStationErrors';
 | 
			
		||||
import { ScanStation } from '../models/entities/ScanStation';
 | 
			
		||||
import { ResponseScanStation } from '../models/responses/ResponseScanStation';
 | 
			
		||||
 | 
			
		||||
@@ -29,18 +30,17 @@ export class ScanStationController {
 | 
			
		||||
		return responseStations;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// @Get('/:id')
 | 
			
		||||
	// @Authorized("SCAN:GET")
 | 
			
		||||
	// @ResponseSchema(ResponseScan)
 | 
			
		||||
	// @ResponseSchema(ResponseTrackScan)
 | 
			
		||||
	// @ResponseSchema(ScanNotFoundError, { statusCode: 404 })
 | 
			
		||||
	// @OnUndefined(ScanNotFoundError)
 | 
			
		||||
	// @OpenAPI({ description: 'Lists all information about the runner whose id got provided.' })
 | 
			
		||||
	// async getOne(@Param('id') id: number) {
 | 
			
		||||
	// 	let scan = await this.scanRepository.findOne({ id: id }, { relations: ['runner'] })
 | 
			
		||||
	// 	if (!scan) { throw new ScanNotFoundError(); }
 | 
			
		||||
	// 	return scan.toResponse();
 | 
			
		||||
	// }
 | 
			
		||||
	@Get('/:id')
 | 
			
		||||
	@Authorized("STATION:GET")
 | 
			
		||||
	@ResponseSchema(ResponseScanStation)
 | 
			
		||||
	@ResponseSchema(ScanStationNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OnUndefined(ScanStationNotFoundError)
 | 
			
		||||
	@OpenAPI({ description: 'Lists all information about the runner whose id got provided.' })
 | 
			
		||||
	async getOne(@Param('id') id: number) {
 | 
			
		||||
		let scan = await this.stationRepository.findOne({ id: id }, { relations: ['track'] })
 | 
			
		||||
		if (!scan) { throw new ScanStationNotFoundError(); }
 | 
			
		||||
		return scan.toResponse();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// @Post()
 | 
			
		||||
	// @Authorized("SCAN:CREATE")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user