chess_rpg_backend/game/serializers.py

39 lines
795 B
Python
Raw Normal View History

2022-06-04 19:30:54 +03:00
from rest_framework import serializers
2022-06-05 13:09:27 +03:00
from game.models import Hero, Player
2022-06-04 19:30:54 +03:00
class CreateHeroSerializer(serializers.ModelSerializer):
class Meta:
model = Hero
2022-06-05 13:09:27 +03:00
fields = (
"type",
"idle_img",
"attack_img",
"die_img",
"health",
"attack",
"speed",
)
2022-06-04 19:30:54 +03:00
class GetHeroSerializer(serializers.ModelSerializer):
class Meta:
model = Hero
fields = (
"added",
"type",
"idle_img",
"attack_img",
"die_img",
"health",
2022-06-05 13:09:27 +03:00
"attack",
2022-06-04 19:30:54 +03:00
"speed",
)
2022-06-05 13:09:27 +03:00
class CreatePlayerView(serializers.ModelSerializer):
class Meta:
model = Player
fields = ("ton_wallet", "name")