Refactor WordPress integration service to use API key for connection testing

- Updated the `IntegrationService` to perform connection tests using only the API key, removing reliance on username and app password.
- Simplified health check logic and improved error messaging for better clarity.
- Added functionality to revoke API keys in the `WordPressIntegrationForm` component.
- Enhanced site settings page with a site selector and improved integration status display.
- Cleaned up unused code and improved overall structure for better maintainability.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-22 09:31:07 +00:00
parent 1a1214d93f
commit 029c66a0f1
12 changed files with 1337 additions and 456 deletions

View File

@@ -27,6 +27,27 @@ class IntegrationViewSet(SiteSectorModelViewSet):
throttle_scope = 'integration'
throttle_classes = [DebugScopedRateThrottle]
def get_queryset(self):
"""
Override to filter integrations by site.
SiteIntegration only has 'site' field (no 'sector'), so SiteSectorModelViewSet's
filtering doesn't apply. We manually filter by site here.
"""
queryset = super().get_queryset()
# Get site parameter from query params
site_id = self.request.query_params.get('site_id') or self.request.query_params.get('site')
if site_id:
try:
site_id_int = int(site_id)
queryset = queryset.filter(site_id=site_id_int)
except (ValueError, TypeError):
# Invalid site_id, return empty queryset
queryset = queryset.none()
return queryset
def get_serializer_class(self):
from rest_framework import serializers