diff --git a/src/modules/auth/auth.dto.ts b/src/modules/auth/auth.dto.ts index 73153d3c7..fae502c79 100644 --- a/src/modules/auth/auth.dto.ts +++ b/src/modules/auth/auth.dto.ts @@ -1,10 +1,76 @@ -import { IsEmail, IsString, MinLength } from 'class-validator'; +import { + IsBoolean, + IsEmail, + IsIn, + IsLocale, + IsNotEmpty, + IsObject, + IsOptional, + IsString, + IsUrl, + Length, + MinLength, +} from 'class-validator'; export class RegisterDto { + @IsString() + @IsNotEmpty() + @MinLength(3) + name: string; + @IsEmail() + @IsNotEmpty() email: string; + @IsBoolean() + @IsOptional() + checkLocationOnLogin: boolean; + @IsString() - @MinLength(3) - name: string; + @Length(2, 2) + @IsOptional() + countryCode: string; + + @IsString() + @IsIn(['MALE', 'FEMALE', 'NONBINARY', 'UNKNOWN']) + @IsOptional() + gender: 'MALE' | 'FEMALE' | 'NONBINARY' | 'UNKNOWN'; + + @IsIn(['ACCOUNT', 'UPDATES', 'PROMOTIONS']) + @IsOptional() + notificationEmails: 'ACCOUNT' | 'UPDATES' | 'PROMOTIONS'; + + @IsString() + @IsOptional() + password: string | null; + + @IsLocale() + @IsOptional() + prefersLanguage: string; + + @IsString() + @IsIn(['NO_PREFERENCE', 'LIGHT', 'DARK']) + @IsOptional() + prefersColorScheme: 'NO_PREFERENCE' | 'LIGHT' | 'DARK'; + + @IsString() + @IsIn(['NO_PREFERENCE', 'REDUCE']) + @IsOptional() + prefersReducedMotion: 'NO_PREFERENCE' | 'REDUCE'; + + @IsUrl() + @IsOptional() + profilePictureUrl: string; + + @IsString() + @IsOptional() + timezone: string; + + @IsBoolean() + @IsOptional() + twoFactorEnabled: boolean; + + @IsObject() + @IsOptional() + attributes: Record; } diff --git a/src/modules/user/user.dto.ts b/src/modules/user/user.dto.ts index 2e6deab67..7d686cc67 100644 --- a/src/modules/user/user.dto.ts +++ b/src/modules/user/user.dto.ts @@ -3,6 +3,7 @@ import { IsIn, IsLocale, IsObject, + IsOptional, IsString, IsUrl, Length, @@ -11,46 +12,59 @@ import { export class UpdateUserDto { @IsBoolean() + @IsOptional() checkLocationOnLogin: boolean; @IsString() @Length(2, 2) + @IsOptional() countryCode: string; @IsString() @IsIn(['MALE', 'FEMALE', 'NONBINARY', 'UNKNOWN']) + @IsOptional() gender: 'MALE' | 'FEMALE' | 'NONBINARY' | 'UNKNOWN'; @IsString() @MinLength(3) + @IsOptional() name: string; @IsIn(['ACCOUNT', 'UPDATES', 'PROMOTIONS']) + @IsOptional() notificationEmails: 'ACCOUNT' | 'UPDATES' | 'PROMOTIONS'; @IsString() + @IsOptional() password: string | null; @IsLocale() + @IsOptional() prefersLanguage: string; @IsString() @IsIn(['NO_PREFERENCE', 'LIGHT', 'DARK']) + @IsOptional() prefersColorScheme: 'NO_PREFERENCE' | 'LIGHT' | 'DARK'; @IsString() @IsIn(['NO_PREFERENCE', 'REDUCE']) + @IsOptional() prefersReducedMotion: 'NO_PREFERENCE' | 'REDUCE'; @IsUrl() + @IsOptional() profilePictureUrl: string; @IsString() + @IsOptional() timezone: string; @IsBoolean() + @IsOptional() twoFactorEnabled: boolean; @IsObject() + @IsOptional() attributes: Record; }