Spaces:
Sleeping
Sleeping
rogerxavier
commited on
Commit
•
ecc6c96
1
Parent(s):
fffc149
Update server/pydanticModel.py
Browse files- server/pydanticModel.py +27 -2
server/pydanticModel.py
CHANGED
@@ -29,6 +29,31 @@ class signUp(BaseModel):
|
|
29 |
return v
|
30 |
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
class signIn(BaseModel):
|
33 |
email: str
|
34 |
password: str
|
@@ -69,8 +94,8 @@ class AfdianOrderDetail(BaseModel):
|
|
69 |
user_id: Optional[str] = Field(default=None, alias="user_id")
|
70 |
plan_id: Optional[str] = Field(default=None, alias="plan_id")
|
71 |
title: Optional[str] = Field(default=None, alias="title") #just afdian test have
|
72 |
-
month: Optional[int] = Field(default=None, alias="month")
|
73 |
-
total_amount: Optional[int] = Field(default=None, alias="total_amount") #
|
74 |
show_amount: Optional[str] = Field(default=None, alias="show_amount")
|
75 |
status: Optional[int] = Field(default=None, alias="status")
|
76 |
remark: Optional[str] = Field(default=None, alias="remark")
|
|
|
29 |
return v
|
30 |
|
31 |
|
32 |
+
class accountDelete(BaseModel):
|
33 |
+
email: str
|
34 |
+
password: str
|
35 |
+
# 可选参数
|
36 |
+
expiredAt: int = Query(default=0, alias="expiredAt")
|
37 |
+
balance: int = Query(default=0, alias="balance")
|
38 |
+
ec: int = Query(default=200, alias="ec")
|
39 |
+
|
40 |
+
|
41 |
+
@field_validator('email')
|
42 |
+
#确保password不为''
|
43 |
+
def check_email(cls, v):
|
44 |
+
if v == '':
|
45 |
+
raise ValueError('email cannot be an empty string')
|
46 |
+
return v
|
47 |
+
|
48 |
+
@field_validator('password')
|
49 |
+
# 确保password不为''
|
50 |
+
def check_password(cls, v):
|
51 |
+
if v == '':
|
52 |
+
raise ValueError('password cannot be an empty string')
|
53 |
+
return v
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
class signIn(BaseModel):
|
58 |
email: str
|
59 |
password: str
|
|
|
94 |
user_id: Optional[str] = Field(default=None, alias="user_id")
|
95 |
plan_id: Optional[str] = Field(default=None, alias="plan_id")
|
96 |
title: Optional[str] = Field(default=None, alias="title") #just afdian test have
|
97 |
+
month: Optional[int] = Field(default=None, alias="month")
|
98 |
+
total_amount: Optional[int] = Field(default=None, alias="total_amount") # 这里精髓在于pydantic会在能转换下自动转int 但字符串 "6.60" 将无法转换为整数,因此会导致 422 错误 因此商品可以回调而兑换码422
|
99 |
show_amount: Optional[str] = Field(default=None, alias="show_amount")
|
100 |
status: Optional[int] = Field(default=None, alias="status")
|
101 |
remark: Optional[str] = Field(default=None, alias="remark")
|