feat: Add account deletion functionality for both agents and regular users.

This commit is contained in:
pradeepkumar
2026-02-09 01:15:45 +05:30
parent 789551e443
commit bbbd83084a
4 changed files with 107 additions and 0 deletions

View File

@@ -227,6 +227,19 @@ export class AgentsController {
return this.agentsService.updatePrivacyPreferences(userId, data);
}
// Delete account endpoint
@Delete('account')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(UserRole.AGENT)
@ApiBearerAuth()
@ApiOperation({ summary: 'Delete agent account permanently (Agents only)' })
@ApiResponse({ status: 200, description: 'Account deleted successfully' })
@ApiResponse({ status: 404, description: 'User not found' })
async deleteAccount(@CurrentUser('id') userId: string) {
return this.agentsService.deleteAccount(userId);
}
// Public parameterized routes - MUST come after specific routes like profile/*
@Get(':id')
@Public()