rwadurian/backend/services/trading-service/src/api/controllers/burn.controller.ts

32 lines
1.1 KiB
TypeScript

import { Controller, Get, Query } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';
import { BurnService } from '../../application/services/burn.service';
import { Public } from '../../shared/guards/jwt-auth.guard';
@ApiTags('Burn')
@Controller('burn')
export class BurnController {
constructor(private readonly burnService: BurnService) {}
@Get('status')
@Public()
@ApiOperation({ summary: '获取销毁状态' })
async getBurnStatus() {
return this.burnService.getBurnStatus();
}
@Get('records')
@Public()
@ApiOperation({ summary: '获取销毁记录' })
@ApiQuery({ name: 'page', required: false, type: Number })
@ApiQuery({ name: 'pageSize', required: false, type: Number })
@ApiQuery({ name: 'sourceType', required: false, enum: ['MINUTE_BURN', 'SELL_BURN'] })
async getBurnRecords(
@Query('page') page?: number,
@Query('pageSize') pageSize?: number,
@Query('sourceType') sourceType?: 'MINUTE_BURN' | 'SELL_BURN',
) {
return this.burnService.getBurnRecords(page ?? 1, pageSize ?? 50, sourceType);
}
}