<reponame>bryanopew/doobi<gh_stars>0
from . models import Cal_result, Foods, Profile, Recc_result
from rest_framework import serializers

class ProfileForReccSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = "__all__"

class CalResultSerializer(serializers.ModelSerializer):
    class Meta:
        model = Cal_result
        fields = "__all__"

        # 위 아니면 리스트, 튜플 형식으로도 가능
        # fields = (
        #     "user",
        #     "bmr",
        #     "amr_total",
        #     "tmr",
        #     "cal_target",
        #     "carb_target_mass",
        #     "prot_target_mass",
        #     "fat_target_mass",
        # )

class CalTargetSerializer(serializers.ModelSerializer):
    class Meta:
        model = Cal_result
        fields = (
            "user",
            "created_at",
            "cal_target",
            "carb_target",
            "prot_target",
            "fat_target",
            "sugar_target",
            "sodium_target",
        )

class ProfileSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = (
            "user",
            "created_at",
            "budget",
            "user_preference1",
            "user_preference2",
            "user_not_like",
        )

class FoodLikedSerializer(serializers.ModelSerializer):
    class Meta:
        model = Foods
        fields = (
            'product_id',
            'product_name',
            'likes',
        )

class FoodsSerializer(serializers.ModelSerializer):
    class Meta:
        model = Foods
        fields = '__all__'

class ReccResultSerializer(serializers.ModelSerializer):
    recommended_food = FoodLikedSerializer()

    class Meta:
        model = Recc_result
        fields = "__all__"

class RecentWeightSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = (
            "created_at",
            "weight"
        )

class PreviousFormSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = '__all__'


from . models import Cal_result, Foods, Profile, Recc_result
from rest_framework import serializers

class ProfileForReccSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = "__all__"

class CalResultSerializer(serializers.ModelSerializer):
    class Meta:
        model = Cal_result
        fields = "__all__"

        # 위 아니면 리스트, 튜플 형식으로도 가능
        # fields = (
        #     "user",
        #     "bmr",
        #     "amr_total",
        #     "tmr",
        #     "cal_target",
        #     "carb_target_mass",
        #     "prot_target_mass",
        #     "fat_target_mass",
        # )

class CalTargetSerializer(serializers.ModelSerializer):
    class Meta:
        model = Cal_result
        fields = (
            "user",
            "created_at",
            "cal_target",
            "carb_target",
            "prot_target",
            "fat_target",
            "sugar_target",
            "sodium_target",
        )

class ProfileSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = (
            "user",
            "created_at",
            "budget",
            "user_preference1",
            "user_preference2",
            "user_not_like",
        )

class FoodLikedSerializer(serializers.ModelSerializer):
    class Meta:
        model = Foods
        fields = (
            'product_id',
            'product_name',
            'likes',
        )

class FoodsSerializer(serializers.ModelSerializer):
    class Meta:
        model = Foods
        fields = '__all__'

class ReccResultSerializer(serializers.ModelSerializer):
    recommended_food = FoodLikedSerializer()

    class Meta:
        model = Recc_result
        fields = "__all__"

class RecentWeightSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = (
            "created_at",
            "weight"
        )

class PreviousFormSerializer(serializers.ModelSerializer):
    class Meta:
        model = Profile
        fields = '__all__'
# 위 아니면 리스트, 튜플 형식으로도 가능 # fields = ( #     "user", #     "bmr", #     "amr_total", #     "tmr", #     "cal_target", #     "carb_target_mass", #     "prot_target_mass", #     "fat_target_mass", # )