Add Auth schema
This commit is contained in:
parent
4e2e02569f
commit
3ab8efe509
28
schemas/auth.py
Normal file
28
schemas/auth.py
Normal file
@ -0,0 +1,28 @@
|
||||
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"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user