| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-06-17 19:19:20 |
| 4 | * @LastEditTime: 2024-12-23 12:45:22 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: Tracing tracing |
| 7 | */ |
| 8 | import { Body, Controller, Post } from '@nestjs/common'; |
| 9 | import { ApiResponse, ApiTags } from '@nestjs/swagger'; |
| 10 | import { ParamsValidationPipe } from 'src/validation.pipe'; |
| 11 | import { CreateTracingDto } from './dto/tracing.dto'; |
| 12 | import { TracingService } from './tracing.service'; |
| 13 | import { TokenInfo } from 'src/auth/interfaces/auth.interfaces'; |
| 14 | import { GetToken } from 'src/auth/auth.guard'; |
| 15 | |
| 16 | @ApiTags('跟踪模块') |
| 17 | @Controller('tracing') |
| 18 | export class TracingController { |
| 19 | constructor(private readonly tracingService: TracingService) {} |
| 20 | |
| 21 | @ApiResponse({ |
| 22 | description: '创建跟踪数据', |
| 23 | type: String, |
| 24 | }) |
| 25 | @Post() |
| 26 | async createTracing( |
| 27 | @GetToken() token: TokenInfo, |
| 28 | @Body(new ParamsValidationPipe()) body: CreateTracingDto, |
| 29 | ) { |
| 30 | const res = await this.tracingService.create({ ...body, userId: token.id }); |
| 31 | return res; |
| 32 | } |
| 33 | } |
| 34 |