Add Auth schema
This commit is contained in:
parent
290808c687
commit
e29917411e
31
schemas/auth.py
Normal file
31
schemas/auth.py
Normal file
@ -0,0 +1,31 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
class AuthBase(BaseModel):
|
||||
user_id: str = Field(..., description="User ID associated with the auth token")
|
||||
token: str = Field(..., description="Authentication token")
|
||||
is_blacklisted: bool = Field(default=False, description="Token blacklist status")
|
||||
expires_at: datetime = Field(..., description="Token expiration timestamp")
|
||||
|
||||
class AuthCreate(AuthBase):
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"user_id": "user123",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"expires_at": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
}
|
||||
|
||||
class Auth(AuthBase):
|
||||
class Config:
|
||||
orm_mode = True
|
||||
schema_extra = {
|
||||
"example": {
|
||||
"user_id": "user123",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"is_blacklisted": False,
|
||||
"expires_at": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user