From e29917411ef0e820866f0ca99078c5124b6caeaf Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 17:10:58 +0000 Subject: [PATCH] Add Auth schema --- schemas/auth.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 schemas/auth.py diff --git a/schemas/auth.py b/schemas/auth.py new file mode 100644 index 0000000..7d5d7bf --- /dev/null +++ b/schemas/auth.py @@ -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" + } + } \ No newline at end of file