Files
schedule-parser-next/src/dto/user.dto.ts
2024-09-06 23:13:44 +04:00

35 lines
779 B
TypeScript

import { ApiProperty, OmitType } from "@nestjs/swagger";
import {
IsJWT,
IsMongoId,
IsString,
MaxLength,
MinLength,
} from "class-validator";
export class UserDto {
@ApiProperty({ description: "Идентификатор (ObjectId)" })
@IsMongoId()
id: string;
@ApiProperty({ example: "n08i40k", description: "Имя" })
@IsString()
@MinLength(4)
@MaxLength(10)
username: string;
@ApiProperty({ description: "Соль пароля" })
@IsString()
salt: string;
@ApiProperty({ description: "Хеш пароля" })
@IsString()
password: string;
@ApiProperty({ description: "Последний токен доступа" })
@IsJWT()
access_token: string;
}
export class ClientUserDto extends OmitType(UserDto, [
"password",
"salt",
"access_token",
]) {}