28 lines
842 B
Python
28 lines
842 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
|
|
class AuthBase(BaseModel):
|
|
token: str = Field(..., description="Authentication token")
|
|
user_id: str = Field(..., description="User identifier")
|
|
device_id: Optional[str] = Field(None, description="Device identifier")
|
|
|
|
class AuthCreate(AuthBase):
|
|
class Config:
|
|
schema_extra = {
|
|
"example": {
|
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
|
|
"user_id": "user123",
|
|
"device_id": "device456"
|
|
}
|
|
}
|
|
|
|
class Auth(AuthBase):
|
|
class Config:
|
|
orm_mode = True
|
|
schema_extra = {
|
|
"example": {
|
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
|
|
"user_id": "user123",
|
|
"device_id": "device456"
|
|
}
|
|
} |