feat: add login swagger fields

This commit is contained in:
2026-09-01 17:38:29 +03:30
parent 195ace097c
commit d1324eb960
11 changed files with 222 additions and 8 deletions
@@ -1,7 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString } from 'class-validator';
export class RefreshTokenDTO {
@IsNotEmpty()
@IsString()
@ApiProperty({
type: 'string',
description: "User's Refresh Token",
required: true,
})
refreshToken!: string;
}
@@ -0,0 +1,15 @@
import { ApiProperty } from '@nestjs/swagger';
export class NewUserLoginResponseDTO {
@ApiProperty({
type: 'boolean',
example: true,
})
newUser!: boolean;
@ApiProperty({
type: 'string',
example: '2026-09-01T09:24:34.894Z',
})
otpExpiresAt!: Date;
}
@@ -0,0 +1,9 @@
import { ApiProperty } from '@nestjs/swagger';
export class RequirePasswordDTO {
@ApiProperty({
type: 'boolean',
example: false,
})
newUser!: boolean;
}
@@ -0,0 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
export class TokensResponseDTO {
@ApiProperty({
type: 'string',
})
access!: string;
@ApiProperty({
type: 'string',
})
refresh!: string;
}
+7
View File
@@ -1,6 +1,7 @@
import { IsNotEmpty, IsString } from 'class-validator';
import { PhoneDTO } from './login.dto';
import { i18nValidationMessage as t } from 'nestjs-i18n';
import { ApiProperty } from '@nestjs/swagger';
export class VerifyOtpDTO extends PhoneDTO {
@IsString()
@@ -9,5 +10,11 @@ export class VerifyOtpDTO extends PhoneDTO {
field: '$t(auth.fields.otp)',
}),
})
@ApiProperty({
type: 'string',
description: '5-digit OTP code',
example: '12345',
required: true,
})
otp!: string;
}