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:
@@ -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';
|
||||
|
||||
31
src/agents/dto/save-field-values.dto.ts
Normal file
31
src/agents/dto/save-field-values.dto.ts
Normal 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user