feat: add field validators for username and password, and integrate them into DTOs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { PasswordFieldValidator, UsernameFieldValidator } from '@/common/utils'
|
||||
import { PartnerStatus, TspProviderType } from '@/generated/prisma/enums'
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsNumber, IsOptional, IsString } from 'class-validator'
|
||||
@@ -21,10 +22,12 @@ export class CreatePartnerDto {
|
||||
// license_quota?: number
|
||||
|
||||
@IsString()
|
||||
@UsernameFieldValidator()
|
||||
@ApiProperty({ required: true })
|
||||
username: string
|
||||
|
||||
@IsString()
|
||||
@PasswordFieldValidator()
|
||||
@ApiProperty({ required: true })
|
||||
password: string
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { PasswordFieldValidator, UsernameFieldValidator } from '@/common/utils'
|
||||
import { ApiProperty, PartialType } from '@nestjs/swagger'
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator'
|
||||
import { PartnerRole } from 'generated/prisma/enums'
|
||||
@@ -5,9 +6,11 @@ import { PartnerRole } from 'generated/prisma/enums'
|
||||
export class CreatePartnerAccountDto {
|
||||
@IsString()
|
||||
@ApiProperty({})
|
||||
@UsernameFieldValidator()
|
||||
username: string
|
||||
|
||||
@IsString()
|
||||
@PasswordFieldValidator()
|
||||
@ApiProperty({})
|
||||
password: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user