UNPKG

pl4y-data-library

Version:

This library contains the dtos, enums, schemas, and other data objects needed in the pl4y ecosystem.

100 lines (78 loc) 1.62 kB
import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, IsOptional, IsPhoneNumber, IsString, MinLength, ValidateNested, } from "class-validator"; import { Type } from "class-transformer"; import { Role } from "../../enums/roles.enum"; import { Address } from "./address.dto"; import { UserType } from "../../enums/user-types.enum"; export class User { _id?: string; id?: string; @IsNotEmpty() @IsString() first_name: string; @IsNotEmpty() @IsString() last_name: string; @IsNotEmpty() @IsEmail() email: string; @IsPhoneNumber("US") @IsOptional() phone?: string; @IsNotEmpty() @MinLength(6) password: string; @IsOptional() isAdmin?: boolean; @IsString() @IsOptional() picture?: string; @IsNumber() @IsOptional() balance: number; @IsString() @IsOptional() tenantId: string; @IsOptional() refreshToken?: string; @IsBoolean() @IsOptional() hasShippingAddress?: boolean; @IsString() @IsOptional() role: Role; @IsString() @IsOptional() status?: string; @IsString() @IsOptional() membership?: string; @ValidateNested() @Type(() => Address) @IsOptional() billingAddress: Address; @ValidateNested() @Type(() => Address) @IsOptional() shippingAddress: Address; @IsString() @IsOptional() parentId?: string; @IsOptional() type?: UserType; @IsNumber() @IsOptional() rate?: number; @IsString() @IsOptional() session_location?: string; }