diff --git a/stratoflights/settings.py b/stratoflights/settings.py index 7e04e74..73444e9 100644 --- a/stratoflights/settings.py +++ b/stratoflights/settings.py @@ -103,7 +103,11 @@ ASGI_APPLICATION = 'stratoflights.asgi.application' # Database # https://docs.djangoproject.com/en/4.2/ref/settings/#databases +<<<<<<< HEAD if not PRODUCTION: +======= +if PRODUCTION: +>>>>>>> origin/master DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -196,7 +200,11 @@ CSRF_TRUSTED_ORIGINS = os.getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost:5173, CHANNEL_LAYERS = { "default": { +<<<<<<< HEAD "BACKEND": "channels.layers.InMemoryChannelLayer", +======= + "BACKEND": "channels_redis.core.RedisChannelLayer", +>>>>>>> origin/master "CONFIG": { "hosts": [("redis", 6379)], }, diff --git a/stratoflights_api/models.py b/stratoflights_api/models.py index 9e36d62..83511c6 100644 --- a/stratoflights_api/models.py +++ b/stratoflights_api/models.py @@ -39,7 +39,11 @@ class Satellite(models.Model): class TelemetryPacket(models.Model): user = models.ForeignKey( +<<<<<<< HEAD get_user_model(), on_delete=models.SET_NULL, null=True, blank=True) +======= + get_user_model(), on_delete=models.CASCADE, default=0) +>>>>>>> origin/master id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) satellite = models.ForeignKey( Satellite, on_delete=models.CASCADE, related_name="telemetry") diff --git a/stratoflights_api/serializers.py b/stratoflights_api/serializers.py index 4c77cf0..3427bf0 100644 --- a/stratoflights_api/serializers.py +++ b/stratoflights_api/serializers.py @@ -124,7 +124,10 @@ class TelemetryPacketSerializer(serializers.ModelSerializer): model = TelemetryPacket fields = ['id', 'timestamp', 'lat', 'lon', 'alt', 'payload'] read_only_fields = ['id'] +<<<<<<< HEAD extra_kwargs = {'timestamp': {'required': False}} +======= +>>>>>>> origin/master class SavedPointSerializer(serializers.ModelSerializer): diff --git a/stratoflights_api/services/tawhiri.py b/stratoflights_api/services/tawhiri.py index 6908083..883edd7 100644 --- a/stratoflights_api/services/tawhiri.py +++ b/stratoflights_api/services/tawhiri.py @@ -6,7 +6,11 @@ from zoneinfo import ZoneInfo from collections import OrderedDict class TawhiriClient: +<<<<<<< HEAD BASE_URL = "https://api.v2.sondehub.org/tawhiri" +======= + BASE_URL = "https://fly.stratonautica.ru/api/v2/" +>>>>>>> origin/master TIMEOUT = 15 @staticmethod diff --git a/stratoflights_api/views.py b/stratoflights_api/views.py index b358bd2..41de2d0 100644 --- a/stratoflights_api/views.py +++ b/stratoflights_api/views.py @@ -156,6 +156,7 @@ class TelemetryListCreateView(generics.ListCreateAPIView): if not serializer.is_valid(): return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +<<<<<<< HEAD try: satellite = Satellite.objects.get(id=pk) except Satellite.DoesNotExist: @@ -197,6 +198,18 @@ class TelemetryListCreateView(generics.ListCreateAPIView): pass # WS broadcast is best-effort; don't fail the REST response return Response({'id': str(packet.id)}, status=status.HTTP_201_CREATED) +======= + validated_data = serializer.validated_data + + TelemetryPacket.objects.create(timestamp=time.time(), + satellite=Satellite.objects.get(id=pk), + lat=validated_data["lat"], + lon=validated_data["lon"], + alt=validated_data["alt"], + payload=validated_data['payload'], + ) + return Response(serializer.errors, status=status.HTTP_201_CREATED) +>>>>>>> origin/master class SessionView(APIView):