feat: Synchronize agent phone numbers between profile and field values, and add optional service areas to agent profile DTO.

This commit is contained in:
pradeepkumar
2026-02-09 02:04:12 +05:30
parent bbbd83084a
commit 6bc0b41e1f
2 changed files with 85 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import {
IsString,
IsOptional,
@@ -6,10 +7,12 @@ import {
IsUrl,
IsUUID,
IsBoolean,
IsArray,
MinLength,
MaxLength,
Min,
Max,
ValidateIf,
} from 'class-validator';
export class CreateAgentProfileDto {
@@ -33,11 +36,13 @@ export class CreateAgentProfileDto {
@MaxLength(100)
lastName: string;
@ApiPropertyOptional({ example: '+1234567890' })
@ApiPropertyOptional({ example: '+1234567890', nullable: true })
@IsOptional()
@ValidateIf((o) => o.phone !== null)
@IsString()
@MaxLength(20)
phone?: string;
@Transform(({ value }) => (value === '' ? null : value))
phone?: string | null;
@ApiPropertyOptional({ example: 'Experienced real estate agent...' })
@IsOptional()
@@ -140,4 +145,13 @@ export class CreateAgentProfileDto {
@IsOptional()
@IsBoolean()
isAvailable?: boolean;
@ApiPropertyOptional({
example: ['Los Angeles', 'San Francisco'],
description: 'Service areas the agent covers',
})
@IsOptional()
@IsArray()
@IsString({ each: true })
serviceAreas?: string[];
}