-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswagger.py
48 lines (32 loc) · 1.44 KB
/
swagger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from rest_framework import serializers
from users.models import User
from budget.models import BudgetCategory, UserBudget
class SwaggerSignupRequestSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "email", "password"]
class SwaggerSignupResponseSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "email"]
class SwaggerLoginRequestSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "password"]
class SwaggerBudgetCategoryResponseSerializer(serializers.ModelSerializer):
class Meta:
model = BudgetCategory
fields = ["id", "name"]
class SwaggerUserBudgetCreateRequestSerializer(serializers.ModelSerializer):
class Meta:
model = UserBudget
fields = ["category", "amount", "period_start", "period_end"]
class SwaggerUserBudgetCreateResponseSerializer(serializers.ModelSerializer):
class Meta:
model = UserBudget
fields = ["id", "category", "amount", "period_start", "period_end"]
class SwaggerBudgetRecommendationRequestSerializer(serializers.Serializer):
total_budget = serializers.DecimalField(max_digits=10, decimal_places=2)
class SwaggerBudgetRecommendationResponseSerializer(serializers.Serializer):
category = serializers.CharField(max_length=100)
amount = serializers.DecimalField(max_digits=10, decimal_places=2)