Skip to content

Commit

Permalink
feat: forward vatis requests to simtraffic
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRomaa committed Feb 8, 2024
1 parent 6b4cc5c commit 2a58fa9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/tmu/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import requests

from rest_framework import status
from rest_framework.authentication import TokenAuthentication
from rest_framework.generics import get_object_or_404
Expand All @@ -24,7 +26,10 @@ def post(self, request):
"""
Create new ATIS (from vATIS).
"""
ATIS.objects.filter(facility=request.data.get('facility')).delete()
# Forward request to SimTraffic so the data is replicated there
requests.post("https://api.simtraffic.net/vatis", data=request.data)

ATIS.objects.filter(facility=request.data.get("facility")).delete()
serializer = ATISSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
Expand Down

0 comments on commit 2a58fa9

Please sign in to comment.