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