feat: Implement privacy preferences for users and agents with new database field, service methods, and API endpoints.

This commit is contained in:
pradeepkumar
2026-02-09 00:55:55 +05:30
parent 6ade2c74c5
commit 789551e443
5 changed files with 191 additions and 0 deletions

View File

@@ -181,6 +181,52 @@ export class AgentsController {
return this.agentsService.updateNotificationPreferences(userId, data);
}
// Privacy preferences endpoints
@Get('preferences/privacy')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.AGENT)
@ApiBearerAuth()
@ApiOperation({ summary: 'Get privacy preferences (Agents only)' })
@ApiResponse({
status: 200,
description: 'Privacy preferences retrieved',
schema: {
example: {
privacySettings: {
profile_visibility: 'public',
contact_info: 'connections',
activity_status: 'public',
},
dataSettings: {
shareAnalytics: false,
personalizedAds: false,
thirdPartySharing: false,
},
},
},
})
async getPrivacyPreferences(@CurrentUser('id') userId: string) {
return this.agentsService.getPrivacyPreferences(userId);
}
@Put('preferences/privacy')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.AGENT)
@ApiBearerAuth()
@ApiOperation({ summary: 'Update privacy preferences (Agents only)' })
@ApiResponse({ status: 200, description: 'Privacy preferences updated' })
async updatePrivacyPreferences(
@CurrentUser('id') userId: string,
@Body()
data: {
privacySettings?: Record<string, string>;
dataSettings?: Record<string, boolean>;
},
) {
return this.agentsService.updatePrivacyPreferences(userId, data);
}
// Public parameterized routes - MUST come after specific routes like profile/*
@Get(':id')
@Public()