Files
AdventureLog/backend/server/integrations/views/integration_view.py
Sean Morley 36631886a2 Add Wanderer author fields and enhance integration with API key authentication
- Introduced `wanderer_author_username` and `wanderer_author_domain` fields to the Trail model for better integration with the Wanderer API.
- Updated TrailSerializer to include new fields and ensure proper backfilling of author information from the Wanderer API.
- Enhanced import/export functionality to handle new author fields for backward compatibility.
- Migrated Wanderer integration to use API key authentication, removing username and token fields for improved security.
- Updated documentation to reflect changes in the Wanderer integration setup and usage.
- Added utility functions for handling GeoJSON data from GPX files and improved error handling in related services.
- Refactored views and serializers to accommodate the new integration structure and ensure seamless user experience.
2026-06-01 20:08:20 -04:00

35 lines
1.3 KiB
Python

import os
from rest_framework.response import Response
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenticated
from integrations.models import ImmichIntegration, StravaToken, WandererIntegration
from django.conf import settings
class IntegrationView(viewsets.ViewSet):
permission_classes = [IsAuthenticated]
def list(self, request):
"""
RESTful GET method for listing all integrations.
"""
immich_integrations = ImmichIntegration.objects.filter(user=request.user)
google_map_integration = settings.GOOGLE_MAPS_API_KEY != ''
strava_integration_global = settings.STRAVA_CLIENT_ID != '' and settings.STRAVA_CLIENT_SECRET != ''
strava_integration_user = StravaToken.objects.filter(user=request.user).exists()
wanderer_integration = WandererIntegration.objects.filter(user=request.user).exists()
return Response(
{
'immich': immich_integrations.exists(),
'google_maps': google_map_integration,
'strava': {
'global': strava_integration_global,
'user': strava_integration_user
},
'wanderer': {
'exists': wanderer_integration,
}
},
status=status.HTTP_200_OK
)