backend/passfinder/recomendations/api/serializers.py

93 lines
2.7 KiB
Python
Raw Normal View History

2023-05-27 11:13:41 +03:00
from rest_framework import serializers
2023-05-28 00:11:44 +03:00
from passfinder.events.api.serializers import (
EventSerializer,
HotelSerializer,
ObjectRouteSerializer,
)
2023-05-27 11:13:41 +03:00
class TinderProceedSerializer(serializers.Serializer):
action = serializers.ChoiceField(["left", "right"], write_only=True)
event = EventSerializer(read_only=True)
class AddToPreferenceSerializer(serializers.Serializer):
oid = serializers.CharField(write_only=True)
class EventOnboardingRetrieve(serializers.Serializer):
events = serializers.ListField(child=EventSerializer(), read_only=True)
types = serializers.ListField(
child=serializers.ChoiceField(["park", "monument", "museum", "unseco"]),
write_only=True,
)
class HotelOnboardingRetrieve(serializers.Serializer):
stars = serializers.ListField(
child=serializers.ChoiceField([1, 2, 3, 4, 5]), write_only=True
)
hotels = serializers.ListField(child=HotelSerializer(), read_only=True)
class TinderGetEventFilterSerializer(serializers.Serializer):
2023-05-28 00:11:44 +03:00
type = serializers.ListField(
child=serializers.ChoiceField(
["attraction", "museum", "movie", "play", "concert"]
)
)
2023-05-27 11:13:41 +03:00
event = EventSerializer()
class DailySelectionNodeSerializer(serializers.Serializer):
2023-05-28 00:11:44 +03:00
action = serializers.ChoiceField(["left", "right"])
2023-05-27 11:13:41 +03:00
oid = serializers.CharField()
class DailySelectionSerializerInput(serializers.Serializer):
city = serializers.CharField(read_only=True)
events = serializers.ListField(child=EventSerializer(), read_only=True)
class DailySelectionSerializer(serializers.Serializer):
nodes = serializers.ListField(child=DailySelectionNodeSerializer(), write_only=True)
type = serializers.ListField(
child=serializers.ChoiceField(
["attraction", "museum", "movie", "play", "concert"]
)
)
event = EventSerializer()
2023-05-27 22:32:52 +03:00
class StarSelectionSerializer(serializers.Serializer):
stars = serializers.ListField(child=serializers.IntegerField(), write_only=True)
class CategorySelectionSerializer(serializers.Serializer):
2023-05-28 00:11:44 +03:00
categories = serializers.ListField(
child=serializers.ChoiceField(
[
"attractions",
"museum",
"movie",
"concert",
"artwork",
"plays",
"shop",
"gallery",
"theme_park",
"viewpoint",
"zoo",
]
)
)
2023-05-27 22:32:52 +03:00
class RecomendationNode(serializers.Serializer):
category = serializers.CharField()
events = serializers.ListField(child=ObjectRouteSerializer())
class SelfRecomendationSerializer(serializers.Serializer):
2023-05-28 00:11:44 +03:00
recomendations = serializers.ListField(child=RecomendationNode(), write_only=True)