Remove unused token schemas from the backend.
Eliminated redundant token-related schemas to simplify the codebase. These models were not actively utilized and their removal helps improve maintainability and reduce clutter in the project.
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TokenBase(BaseModel):
|
||||
"""Base token schema with common attributes."""
|
||||
token_type: str = Field(default="bearer", description="Type of authentication token")
|
||||
expires_in: int = Field(description="Token expiration time in seconds")
|
||||
|
||||
|
||||
class Token(TokenBase):
|
||||
"""Schema for authentication response containing both access and refresh tokens."""
|
||||
access_token: str = Field(description="JWT access token")
|
||||
refresh_token: str = Field(description="JWT refresh token for obtaining new access tokens")
|
||||
|
||||
|
||||
class TokenPayload(BaseModel):
|
||||
"""Schema representing the decoded JWT token payload."""
|
||||
sub: str = Field(description="Subject identifier (user ID)")
|
||||
type: str = Field(description="Token type (access or refresh)")
|
||||
exp: datetime = Field(description="Token expiration timestamp")
|
||||
iat: datetime = Field(description="Token issued at timestamp")
|
||||
jti: Optional[str] = Field(None, description="JWT ID - unique identifier for the token")
|
||||
|
||||
|
||||
class RefreshToken(BaseModel):
|
||||
"""Schema for refresh token requests."""
|
||||
refresh_token: str = Field(
|
||||
...,
|
||||
description="JWT refresh token used to obtain new access tokens"
|
||||
)
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""Schema for detailed token information response."""
|
||||
access_token: str = Field(description="JWT access token")
|
||||
refresh_token: str = Field(description="JWT refresh token")
|
||||
token_type: str = Field(default="bearer")
|
||||
expires_in: int = Field(description="Token expiration time in seconds")
|
||||
scope: Optional[str] = Field(None, description="Token scope")
|
||||
user_id: str = Field(description="ID of the authenticated user")
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"token_type": "bearer",
|
||||
"expires_in": 1800,
|
||||
"scope": "read write",
|
||||
"user_id": "123e4567-e89b-12d3-a456-426614174000"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user