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

@@ -21,6 +21,7 @@ import {
CreateAgentProfileDto,
UpdateAgentProfileDto,
SearchAgentsDto,
SaveFieldValuesDto,
} from './dto';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { RolesGuard } from '../auth/guards/roles.guard';
@@ -117,6 +118,31 @@ export class AgentsController {
return this.agentsService.updateProfile(userId, dto);
}
@Put('profile/field-values')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.AGENT)
@ApiBearerAuth()
@ApiOperation({ summary: 'Save dynamic field values for agent profile' })
@ApiResponse({ status: 200, description: 'Field values saved successfully' })
@ApiResponse({ status: 404, description: 'Profile not found' })
async saveFieldValues(
@CurrentUser('id') userId: string,
@Body() dto: SaveFieldValuesDto,
) {
return this.agentsService.saveFieldValues(userId, dto);
}
@Get('profile/field-values')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.AGENT)
@ApiBearerAuth()
@ApiOperation({ summary: 'Get dynamic field values for agent profile' })
@ApiResponse({ status: 200, description: 'Field values retrieved successfully' })
@ApiResponse({ status: 404, description: 'Profile not found' })
async getFieldValues(@CurrentUser('id') userId: string) {
return this.agentsService.getFieldValues(userId);
}
// Admin endpoints
@Get('admin/list')