diff --git a/backend/services/mining-admin-service/src/api/controllers/auth.controller.ts b/backend/services/mining-admin-service/src/api/controllers/auth.controller.ts index 5f9a089a..302988c5 100644 --- a/backend/services/mining-admin-service/src/api/controllers/auth.controller.ts +++ b/backend/services/mining-admin-service/src/api/controllers/auth.controller.ts @@ -1,9 +1,20 @@ import { Controller, Post, Body, Req, HttpCode, HttpStatus } from '@nestjs/common'; -import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; +import { ApiTags, ApiOperation, ApiBearerAuth, ApiProperty } from '@nestjs/swagger'; +import { IsString, IsNotEmpty } from 'class-validator'; import { AuthService } from '../../application/services/auth.service'; import { Public } from '../../shared/guards/admin-auth.guard'; -class LoginDto { username: string; password: string; } +class LoginDto { + @ApiProperty({ description: '用户名' }) + @IsString() + @IsNotEmpty() + username: string; + + @ApiProperty({ description: '密码' }) + @IsString() + @IsNotEmpty() + password: string; +} @ApiTags('Auth') @Controller('auth')