fix(trading): 为所有 DTO 添加 class-validator 装饰器
修复 trading.controller、admin.controller、transfer.controller 的 DTO 验证问题,解决 App 下单时 400 错误。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
dd011c13d4
commit
1760f9b82c
|
|
@ -1,14 +1,17 @@
|
|||
import { Controller, Get, Post, Body, HttpCode, HttpStatus } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { PrismaService } from '../../infrastructure/persistence/prisma/prisma.service';
|
||||
import { TradingConfigRepository } from '../../infrastructure/persistence/repositories/trading-config.repository';
|
||||
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||
|
||||
class SetBuyEnabledDto {
|
||||
@IsBoolean()
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
class SetDepthEnabledDto {
|
||||
@IsBoolean()
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
import { Controller, Get, Post, Param, Query, Body, NotFoundException, Req } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiParam, ApiQuery, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { IsString, IsIn } from 'class-validator';
|
||||
import { OrderService } from '../../application/services/order.service';
|
||||
import { OrderRepository } from '../../infrastructure/persistence/repositories/order.repository';
|
||||
import { TradingAccountRepository } from '../../infrastructure/persistence/repositories/trading-account.repository';
|
||||
import { OrderType } from '../../domain/aggregates/order.aggregate';
|
||||
|
||||
class CreateOrderDto {
|
||||
@IsIn(['BUY', 'SELL'])
|
||||
type: 'BUY' | 'SELL';
|
||||
|
||||
@IsString()
|
||||
price: string;
|
||||
|
||||
@IsString()
|
||||
quantity: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { Controller, Get, Post, Param, Query, Body, Req } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiQuery } from '@nestjs/swagger';
|
||||
import { IsString } from 'class-validator';
|
||||
import { TransferService } from '../../application/services/transfer.service';
|
||||
|
||||
class TransferDto {
|
||||
@IsString()
|
||||
amount: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue