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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user