51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|||
|
|
|
|||
|
|
export class UserDto {
|
|||
|
|
@ApiProperty({ example: 'clx...' })
|
|||
|
|
id: string;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: 'user@example.com', nullable: true })
|
|||
|
|
email: string | null;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: '张三', nullable: true })
|
|||
|
|
nickname: string | null;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: null, nullable: true })
|
|||
|
|
avatarUrl: string | null;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: 'user' })
|
|||
|
|
role: string;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: 'active' })
|
|||
|
|
status: string;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: false })
|
|||
|
|
onboardingCompleted: boolean;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export class AuthTokensDto {
|
|||
|
|
@ApiProperty({ description: 'JWT access token,有效期 1h', example: 'eyJhbG...' })
|
|||
|
|
accessToken: string;
|
|||
|
|
|
|||
|
|
@ApiProperty({ description: '96 位十六进制 refresh token,一次性轮换', example: 'a1b2c3...' })
|
|||
|
|
refreshToken: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export class LoginResponseDto extends AuthTokensDto {
|
|||
|
|
@ApiProperty({ type: UserDto })
|
|||
|
|
user: UserDto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export class RefreshResponseDto extends AuthTokensDto {
|
|||
|
|
@ApiProperty({ type: UserDto })
|
|||
|
|
user: UserDto;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export class LogoutResponseDto {
|
|||
|
|
@ApiProperty({ example: true })
|
|||
|
|
success: boolean;
|
|||
|
|
|
|||
|
|
@ApiProperty({ example: '已退出登录' })
|
|||
|
|
message: string;
|
|||
|
|
}
|