| 19 | @Controller('bus') |
| 20 | @UsePipes(ValidationPipe) |
| 21 | export class BusController { |
| 22 | constructor( |
| 23 | private readonly busService: BusService, |
| 24 | private readonly redis: RedisService |
| 25 | ) {} |
| 26 | @Get('schedule') |
| 27 | async getBusSchedule() { |
| 28 | return this.busService.getBusSchedule(); |
| 29 | } |
| 30 | @UseGuards(JwtAuthGuard, AdminGuard) |
| 31 | @Get('booked-tickets') |
| 32 | async getBookedTickets() { |
| 33 | return this.busService.getBookedTickets(); |
| 34 | } |
| 35 | @UseGuards(JwtAuthGuard, AdminGuard) |
| 36 | @Post('bus') |
| 37 | async createNewBus(@Body() bus: BusDto) { |
| 38 | try { |
| 39 | return this.busService.createBus(bus); |
| 40 | } catch (error) { |
| 41 | if (error instanceof HttpException) { |
| 42 | throw new HttpException(error.message, error.getStatus()); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | @UseGuards(JwtAuthGuard, AdminGuard) |
| 47 | @Get('conductor') |
| 48 | async getAllConductors() { |
| 49 | try { |
| 50 | return this.busService.getConductors(); |
| 51 | } catch (error) { |
| 52 | if (error instanceof HttpException) { |
| 53 | throw new HttpException(error.message, error.getStatus()); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | @UseGuards(JwtAuthGuard, AdminGuard) |
| 58 | @Get('conductor/:id') |
| 59 | async getConductorById(@Param('id') conductorId: string) { |
| 60 | try { |
| 61 | return this.busService.getConductorById(conductorId); |
| 62 | } catch (error) { |
| 63 | if (error instanceof HttpException) { |
| 64 | throw new HttpException(error.message, error.getStatus()); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | @UseGuards(JwtAuthGuard, AdminGuard) |
| 69 | @Get('contractor') |
| 70 | async getAllContractors() { |
| 71 | try { |
| 72 | return this.busService.getContractors(); |
| 73 | } catch (error) { |
| 74 | if (error instanceof HttpException) { |
| 75 | throw new HttpException(error.message, error.getStatus()); |
| 76 | } |
| 77 | } |
| 78 | } |
nothing calls this directly
no outgoing calls
no test coverage detected