This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
swagger.py
71 lines (57 loc) · 1.59 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from rest_framework import serializers
from drf_yasg import openapi
from users.models import User
# Parameters
QUERY_LAT = openapi.Parameter(
"lat",
openapi.IN_QUERY,
type=openapi.TYPE_STRING,
description="사용자 위도",
required=True,
)
QUERY_LON = openapi.Parameter(
"lon",
openapi.IN_QUERY,
type=openapi.TYPE_STRING,
description="사용자 경도",
required=True,
)
QUERY_RANGE = openapi.Parameter(
"range",
openapi.IN_QUERY,
type=openapi.TYPE_STRING,
description="검색 범위, 단위는 km",
required=True,
)
QUERY_SORT_TYPE = openapi.Parameter(
"sort_type",
openapi.IN_QUERY,
type=openapi.TYPE_STRING,
description="정렬 타입, 거리순 또는 평점순, 현재는 오름차순만 구현",
default="거리순",
)
PATH_RESTAURANT_ID = openapi.Parameter(
"restaurant_id",
openapi.IN_PATH,
type=openapi.TYPE_INTEGER,
description="맛집 고유번호",
required=True,
)
PATH_RESTAURANT_ID_NOT_REQUIRED = openapi.Parameter(
"restaurant_id",
openapi.IN_PATH,
type=openapi.TYPE_INTEGER,
description="맛집 고유번호",
)
class SwaggerSignupRequestSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "email", "password"]
class SwaggerSignupResponseSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "email", "password", "is_recommend"]
class SwaggerLoginRequestSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "password"]