9c504d2c3d
Features: - Frontend Flutter avec thème néon cyberpunk - Backend FastAPI avec streaming YouTube - Base de données PostgreSQL + Redis - Authentification JWT complète - Recherche multi-source (DB + YouTube) - Playlists CRUD avec drag & drop - Queue management - Settings avec audio quality - Interface adaptative (Desktop + Mobile) Tech Stack: - Frontend: Flutter 3.2+, Riverpod - Backend: Python 3.11+, FastAPI - Database: PostgreSQL 15+ - Cache: Redis 7+ - Streaming: yt-dlp + FFmpeg 🚀 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
1.6 KiB
Python
72 lines
1.6 KiB
Python
"""Authentication schemas."""
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr, Field, ConfigDict
|
|
|
|
|
|
class UserBase(BaseModel):
|
|
"""Base user schema."""
|
|
|
|
email: EmailStr
|
|
username: str = Field(..., min_length=3, max_length=50)
|
|
display_name: Optional[str] = Field(None, max_length=100)
|
|
|
|
|
|
class UserCreate(UserBase):
|
|
"""Schema for creating a new user."""
|
|
|
|
password: str = Field(..., min_length=8, max_length=100)
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
"""Schema for updating user profile."""
|
|
|
|
display_name: Optional[str] = Field(None, max_length=100)
|
|
avatar_url: Optional[str] = None
|
|
date_of_birth: Optional[datetime] = None
|
|
country: Optional[str] = Field(None, max_length=2)
|
|
|
|
|
|
class UserResponse(UserBase):
|
|
"""Schema for user response."""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: str
|
|
display_name: Optional[str] = None
|
|
avatar_url: Optional[str] = None
|
|
is_premium: bool = False
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class Token(BaseModel):
|
|
"""Schema for JWT token response."""
|
|
|
|
access_token: str
|
|
refresh_token: str
|
|
token_type: str = "bearer"
|
|
expires_in: int # seconds
|
|
|
|
|
|
class TokenPayload(BaseModel):
|
|
"""Schema for JWT token payload."""
|
|
|
|
sub: str # user id
|
|
exp: int # expiration timestamp
|
|
type: str # "access" or "refresh"
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
"""Schema for login request."""
|
|
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
class RefreshTokenRequest(BaseModel):
|
|
"""Schema for token refresh request."""
|
|
|
|
refresh_token: str
|