feat: Change auth flow
This commit is contained in:
42
src/auth/dto/complete-setup.dto.ts
Normal file
42
src/auth/dto/complete-setup.dto.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsNotEmpty, IsOptional, IsString, MinLength } from "class-validator";
|
||||
|
||||
export class CompleteProfileSetupRequestDTO {
|
||||
@ApiProperty({
|
||||
description: "User's firstName",
|
||||
example: 'John',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
firstName: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "User's middleName",
|
||||
example: 'Kumar',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
middleName?: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's lastName",
|
||||
example: 'Doe',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
lastName: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's password",
|
||||
example: '123456',
|
||||
type: 'string',
|
||||
minLength: 6,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MinLength(6)
|
||||
password: string;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
export * from './register-user.dto';
|
||||
export * from './login-user.dto';
|
||||
export * from './login-response.dto';
|
||||
export * from "./validate-otp.dto";
|
||||
export * from "./complete-setup.dto";
|
||||
|
||||
@@ -2,39 +2,9 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import {
|
||||
IsEmail,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MinLength,
|
||||
} from 'class-validator';
|
||||
|
||||
export class RegisterUserRequestDTO {
|
||||
@ApiProperty({
|
||||
description: "User's firstName",
|
||||
example: 'John',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
firstName: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "User's middleName",
|
||||
example: 'Kumar',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
middleName?: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's lastName",
|
||||
example: 'Doe',
|
||||
type: 'string',
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
lastName: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's email",
|
||||
example: 'user@example.com',
|
||||
@@ -43,15 +13,4 @@ export class RegisterUserRequestDTO {
|
||||
@IsEmail()
|
||||
@IsNotEmpty()
|
||||
email: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's password",
|
||||
example: '123456',
|
||||
type: 'string',
|
||||
minLength: 6,
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MinLength(6)
|
||||
password: string;
|
||||
}
|
||||
|
||||
22
src/auth/dto/validate-otp.dto.ts
Normal file
22
src/auth/dto/validate-otp.dto.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsEmail, IsNotEmpty, IsNumber } from "class-validator";
|
||||
|
||||
export class ValidateUserRegisterOTPRequestDTO {
|
||||
@ApiProperty({
|
||||
description: "Register OTP",
|
||||
example: 123456,
|
||||
type: 'number',
|
||||
})
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
otp: number
|
||||
|
||||
@ApiProperty({
|
||||
description: "User's email",
|
||||
example: 'user@example.com',
|
||||
type: 'string',
|
||||
})
|
||||
@IsEmail()
|
||||
@IsNotEmpty()
|
||||
email: string;
|
||||
}
|
||||
Reference in New Issue
Block a user