Add Auth schema

This commit is contained in:
Backend IM Bot 2025-03-26 17:10:58 +00:00
parent 290808c687
commit e29917411e

31
schemas/auth.py Normal file
View 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"
}
}