mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-14 02:20:53 +08:00
39 lines
773 B
Python
39 lines
773 B
Python
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
username: str = Field(..., min_length=4, max_length=20, regex=r"^[a-zA-Z0-9_]+$")
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
password: str = Field(..., min_length=8)
|
|
|
|
|
|
class UserUpdate(UserBase):
|
|
password: str = Field(..., min_length=8)
|
|
|
|
|
|
class User(UserBase):
|
|
user_id: int
|
|
password: str = Field(..., min_length=8)
|
|
id: str = Field(..., alias="_id")
|
|
|
|
|
|
class UserInDB(UserBase):
|
|
password: str = Field(..., min_length=8)
|
|
|
|
|
|
class UserLogin(BaseModel):
|
|
username: str
|
|
password: str = Field(..., min_length=8)
|
|
|
|
|
|
class Token(BaseModel):
|
|
token: str
|
|
token_type: str
|
|
|
|
|
|
class TokenData(BaseModel):
|
|
username: str | None = None |