apigateway / core /schemas.py
jebin2's picture
client detect
05b100e
from pydantic import BaseModel, EmailStr, Field
from typing import Optional
# Pydantic Models for Google OAuth Authentication
class CheckRegistrationRequest(BaseModel):
"""Check if a user_id has completed registration."""
user_id: str = Field(..., min_length=1, description="Temporary user ID from frontend")
class GoogleAuthRequest(BaseModel):
"""Request with Google ID token from frontend Sign-In."""
id_token: str = Field(..., min_length=1, description="Google ID token from Sign-In")
temp_user_id: Optional[str] = Field(None, description="Optional temp user ID for linking")
client_type: Optional[str] = Field(None, description="Client type: 'web' or 'mobile' (auto-detected if not provided)")
class AuthResponse(BaseModel):
"""Response after successful Google authentication."""
success: bool
access_token: str
refresh_token: str
user_id: str
email: str
name: Optional[str] = None
credits: int
is_new_user: bool
class UserInfoResponse(BaseModel):
"""Response containing current user information."""
user_id: str
email: str
name: Optional[str] = None
credits: int
profile_picture: Optional[str] = None
class TokenRefreshRequest(BaseModel):
"""Request to refresh an access token."""
"""Request to refresh an access token."""
token: Optional[str] = Field(None, description="Current refresh token (optional if in cookie)")
class TokenRefreshResponse(BaseModel):
"""Response with refreshed access token."""
success: bool
access_token: str
refresh_token: str