This commit is contained in:
2024-09-06 23:13:44 +04:00
parent 2b2018c317
commit 31906fbbd1
29 changed files with 2061 additions and 90 deletions

34
src/dto/user.dto.ts Normal file
View File

@@ -0,0 +1,34 @@
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",
]) {}