| 12 | import {Request} from 'src/types'; |
| 13 | @Controller('orders') |
| 14 | export class OrdersController { |
| 15 | constructor(private readonly ordersService: OrdersService) {} |
| 16 | @UseGuards(JwtAuthGuard) |
| 17 | @Post('/create') |
| 18 | async createOrder(@Req() request: Request) { |
| 19 | return this.ordersService.createOrder( |
| 20 | request.body.scheduleId, |
| 21 | request.body.ticketQuantity, |
| 22 | request.user.id |
| 23 | ); |
| 24 | } |
| 25 | |
| 26 | @UseGuards(JwtAuthGuard) |
| 27 | @Get('/recent') |
| 28 | async getRecentOrders() { |
| 29 | try { |
| 30 | const orders = await this.ordersService.getRecentOrders(); |
| 31 | return orders; |
| 32 | } catch (error) { |
| 33 | if (error instanceof HttpException) { |
| 34 | throw new HttpException(error.message, error.getStatus()); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected