| 20 | @UseGuards(TokenGuard) |
| 21 | @Controller('orders') |
| 22 | export class OrdersController { |
| 23 | constructor(private readonly ordersService: OrdersService) {} |
| 24 | |
| 25 | @Post() |
| 26 | create(@Body() createOrderDto: CreateOrderDto) { |
| 27 | return this.ordersService.create(createOrderDto); |
| 28 | } |
| 29 | |
| 30 | @Get() |
| 31 | findAll() { |
| 32 | return this.ordersService.findAll(); |
| 33 | } |
| 34 | |
| 35 | @Get(':id') |
| 36 | findOne(@Param('id') id: string) { |
| 37 | return this.ordersService.findOneUsingAccount(id); |
| 38 | } |
| 39 | |
| 40 | @Patch(':id') |
| 41 | update(@Param('id') id: string, @Body() updateOrderDto: UpdateOrderDto) { |
| 42 | return this.ordersService.update(id, updateOrderDto); |
| 43 | } |
| 44 | |
| 45 | @HttpCode(204) |
| 46 | @Delete(':id') |
| 47 | remove(@Param('id') id: string) { |
| 48 | return this.ordersService.remove(id); |
| 49 | } |
| 50 | |
| 51 | @MessagePattern('transactions_result') |
| 52 | async consumerUpdateStatus(@Payload() message: KafkaMessage) { |
| 53 | const data = message.value as any; |
| 54 | console.log(data); |
| 55 | const { id, status } = data as { id: string; status: OrderStatus }; |
| 56 | await this.ordersService.update(id, { status }); |
| 57 | } |
| 58 | } |
nothing calls this directly
no outgoing calls
no test coverage detected