-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas.py
65 lines (48 loc) · 1.27 KB
/
schemas.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
from pydantic import BaseModel
from typing import Optional
class SignUpModel(BaseModel):
id:Optional[int]
username:str
email:str
password:str
is_staff:Optional[bool]
is_active:Optional[bool]
class Config:
orm_mode=True
schema_extra={
'example':{
"username":"johndoe",
"email":"johndoe@gmail.com",
"password":"password",
"is_staff":False,
"is_active":True
}
}
class LoginModel(BaseModel):
username:str
password:str
class OrderModel(BaseModel):
id:Optional[int]
quantity:int
order_status:Optional[str]="PENDING"
pizza_size:Optional[str]="SMALL"
user_id:Optional[int]
class Config:
orm_mode=True
schema_extra={
"example":{
"quantity":2,
"pizza_size":"LARGE"
}
}
class OrderStatusModel(BaseModel):
order_status:Optional[str]="PENDING"
class Config:
orm_mode=True
schema_extra={
"example":{
"order_status":"PENDING"
}
}
class TokenData(BaseModel):
username: Optional[str] = None