11
This commit is contained in:
@@ -7,8 +7,17 @@ CardKeyType = Literal["时长", "点数"]
|
||||
|
||||
|
||||
class CardKeyActivateRequest(BaseModel):
|
||||
username: str = Field(min_length=1, max_length=64)
|
||||
serial_number: str = Field(min_length=1, max_length=64)
|
||||
|
||||
@field_validator("username")
|
||||
@classmethod
|
||||
def normalize_username(cls, value: str) -> str:
|
||||
stripped = value.strip()
|
||||
if not stripped:
|
||||
raise ValueError("请输入用户名")
|
||||
return stripped
|
||||
|
||||
@field_validator("serial_number")
|
||||
@classmethod
|
||||
def normalize_serial(cls, value: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user