feat: Add dynamic field value management for agent profiles, including DTOs, controller endpoints, and service logic for saving and retrieving.

This commit is contained in:
pradeepkumar
2026-01-24 21:06:08 +05:30
parent 8dc8a961ab
commit 5844d17837
4 changed files with 301 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
export * from './create-agent-profile.dto';
export * from './update-agent-profile.dto';
export * from './search-agents.dto';
export * from './save-field-values.dto';

View File

@@ -0,0 +1,31 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsArray, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';
export class FieldValueDto {
@ApiProperty({
example: 'first-name',
description: 'Field slug',
})
@IsString()
@IsNotEmpty()
fieldSlug: string;
@ApiProperty({
example: 'John',
description: 'Field value - can be string, number, boolean, array, or object',
})
@IsOptional()
value: string | number | boolean | string[] | Record<string, unknown> | null;
}
export class SaveFieldValuesDto {
@ApiProperty({
type: [FieldValueDto],
description: 'Array of field values to save',
})
@IsArray()
@ValidateNested({ each: true })
@Type(() => FieldValueDto)
fieldValues: FieldValueDto[];
}