mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-07-31 07:49:07 -04:00
- 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.
30 lines
886 B
Python
30 lines
886 B
Python
from .models import ImmichIntegration, WandererIntegration
|
|
from rest_framework import serializers
|
|
|
|
|
|
class WandererIntegrationSerializer(serializers.ModelSerializer):
|
|
api_key = serializers.CharField(write_only=True, required=False)
|
|
|
|
class Meta:
|
|
model = WandererIntegration
|
|
fields = ['id', 'server_url', 'api_key']
|
|
read_only_fields = ['id']
|
|
|
|
def to_representation(self, instance):
|
|
return {
|
|
'id': str(instance.id),
|
|
'server_url': instance.server_url,
|
|
}
|
|
|
|
|
|
class ImmichIntegrationSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = ImmichIntegration
|
|
fields = '__all__'
|
|
read_only_fields = ['id', 'user']
|
|
|
|
def to_representation(self, instance):
|
|
representation = super().to_representation(instance)
|
|
representation.pop('user', None)
|
|
return representation
|