Files
wwjcloud-nest-v1/wwjcloud/src/common/auth/dto/AuthDto.ts

33 lines
874 B
TypeScript
Raw Normal View History

import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNumber, IsOptional, MinLength, MaxLength } from 'class-validator';
export class LoginDto {
@ApiProperty({ description: '用户名', example: 'admin' })
@IsString()
@MinLength(3)
@MaxLength(50)
username: string;
@ApiProperty({ description: '密码', example: '123456' })
@IsString()
@MinLength(6)
@MaxLength(100)
password: string;
@ApiProperty({ description: '站点ID', example: 0, required: false })
@IsOptional()
@IsNumber()
siteId?: number;
}
export class RefreshTokenDto {
@ApiProperty({ description: '刷新Token', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
@IsString()
refreshToken: string;
}
export class LogoutDto {
@ApiProperty({ description: '访问Token', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' })
@IsString()
token: string;
}