2025-08-24 02:31:42 +08:00
|
|
|
import { ApiProperty } from '@nestjs/swagger';
|
2025-08-27 11:24:22 +08:00
|
|
|
import {
|
|
|
|
|
IsString,
|
|
|
|
|
IsNumber,
|
|
|
|
|
IsOptional,
|
|
|
|
|
MinLength,
|
|
|
|
|
MaxLength,
|
|
|
|
|
} from 'class-validator';
|
2025-08-24 02:31:42 +08:00
|
|
|
|
|
|
|
|
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 {
|
2025-08-27 11:24:22 +08:00
|
|
|
@ApiProperty({
|
|
|
|
|
description: '刷新Token',
|
|
|
|
|
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
|
|
|
|
|
})
|
2025-08-24 02:31:42 +08:00
|
|
|
@IsString()
|
|
|
|
|
refreshToken: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class LogoutDto {
|
2025-08-27 11:24:22 +08:00
|
|
|
@ApiProperty({
|
|
|
|
|
description: '访问Token',
|
|
|
|
|
example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
|
|
|
|
|
})
|
2025-08-24 02:31:42 +08:00
|
|
|
@IsString()
|
|
|
|
|
token: string;
|
2025-08-27 11:24:22 +08:00
|
|
|
}
|