mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-24 21:32:28 +00:00
feat: fix swagger examples
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { ApiDataResponse } from '~/core/decorators';
|
||||
import { ResponseFactory } from '~/core/utils';
|
||||
import { CreateUnverifiedUserV2RequestDto, VerifyUserV2RequestDto } from '../dtos/request';
|
||||
import { LoginResponseDto } from '../dtos/response/login.response.dto';
|
||||
@ -11,12 +12,14 @@ import { AuthService } from '../services';
|
||||
export class AuthV2Controller {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
@Post('register/otp')
|
||||
@ApiDataResponse(SendRegisterOtpV2ResponseDto)
|
||||
async register(@Body() createUnverifiedUserDto: CreateUnverifiedUserV2RequestDto) {
|
||||
const phoneNumber = await this.authService.sendPhoneRegisterOtp(createUnverifiedUserDto);
|
||||
return ResponseFactory.data(new SendRegisterOtpV2ResponseDto(phoneNumber));
|
||||
}
|
||||
|
||||
@Post('register/verify')
|
||||
@ApiDataResponse(LoginResponseDto)
|
||||
async verifyUser(@Body() verifyUserDto: VerifyUserV2RequestDto) {
|
||||
const [loginResponse, user] = await this.authService.verifyUserV2(verifyUserDto);
|
||||
return ResponseFactory.data(new LoginResponseDto(loginResponse, user));
|
||||
|
@ -17,7 +17,7 @@ export class LoginResponseDto {
|
||||
@ApiProperty({ example: UserResponseDto })
|
||||
user!: UserResponseDto;
|
||||
|
||||
@ApiProperty({ example: CustomerResponseDto })
|
||||
@ApiProperty({ type: CustomerResponseDto })
|
||||
customer!: CustomerResponseDto | null;
|
||||
|
||||
constructor(IVerifyUserResponse: ILoginResponse, user: User) {
|
||||
|
@ -1,79 +1,79 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Customer } from '~/customer/entities';
|
||||
import { CustomerStatus, KycStatus } from '~/customer/enums';
|
||||
import { CustomerStatus, Gender, KycStatus } from '~/customer/enums';
|
||||
import { DocumentMetaResponseDto } from '~/document/dtos/response';
|
||||
|
||||
export class CustomerResponseDto {
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: '123e4567-e89b-12d3-a456-426614174000' })
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: CustomerStatus.PENDING })
|
||||
customerStatus!: CustomerStatus;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: KycStatus.PENDING })
|
||||
kycStatus!: KycStatus;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Rejection reason if any' })
|
||||
rejectionReason!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'John' })
|
||||
firstName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Doe' })
|
||||
lastName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: '1990-01-01' })
|
||||
dateOfBirth!: Date;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: '123456789' })
|
||||
nationalId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: '2025-01-01' })
|
||||
nationalIdExpiry!: Date;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'JO' })
|
||||
countryOfResidence!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Employee' })
|
||||
sourceOfIncome!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Software Development' })
|
||||
profession!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Full-time' })
|
||||
professionType!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: false })
|
||||
isPep!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: Gender.MALE })
|
||||
gender!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: false })
|
||||
isJunior!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: true })
|
||||
isGuardian!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 12345 })
|
||||
waitingNumber!: number;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'SA' })
|
||||
country!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Riyadh' })
|
||||
region!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Riyadh City' })
|
||||
city!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'Al-Masif' })
|
||||
neighborhood!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: 'King Fahd Road' })
|
||||
street!: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
@ApiProperty({ example: '123' })
|
||||
building!: string | null;
|
||||
|
||||
@ApiPropertyOptional({ type: DocumentMetaResponseDto })
|
||||
|
Reference in New Issue
Block a user