a89c7894cf
Backend: - FastAPI avec PostgreSQL et Redis - Authentification JWT complète - API REST pour musique, playlists, recherche - Streaming audio via yt-dlp - SQLAlchemy 2.0 async Frontend: - Flutter avec thème néon cyberpunk - State management Riverpod - Layout adaptatif desktop/mobile - Lecteur audio avec mini-player Infrastructure: - Docker Compose (PostgreSQL + Redis) - Scripts d'installation automatisés - Scripts de build pour exécutables Fichiers ajoutés: - BUILD_CLIENT_*.bat/sh: Scripts de compilation - BUILD_CLIENT_README.md: Documentation compilation - CHECK_FLUTTER.sh: Vérificateur d'environnement - requirements.txt mis à jour pour Python 3.13 - Modèles SQLAlchemy corrigés (metadata -> extra_metadata) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
1.8 KiB
Python
80 lines
1.8 KiB
Python
"""Playlist schemas."""
|
|
from datetime import datetime
|
|
from typing import Optional, List
|
|
from uuid import UUID
|
|
|
|
from pydantic import BaseModel, Field, ConfigDict
|
|
|
|
|
|
class PlaylistBase(BaseModel):
|
|
"""Base playlist schema."""
|
|
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
description: Optional[str] = None
|
|
image_url: Optional[str] = None
|
|
is_public: bool = False
|
|
is_collaborative: bool = False
|
|
|
|
|
|
class PlaylistCreate(PlaylistBase):
|
|
"""Schema for creating a playlist."""
|
|
|
|
pass
|
|
|
|
|
|
class PlaylistUpdate(BaseModel):
|
|
"""Schema for updating a playlist."""
|
|
|
|
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
|
description: Optional[str] = None
|
|
image_url: Optional[str] = None
|
|
is_public: Optional[bool] = None
|
|
is_collaborative: Optional[bool] = None
|
|
|
|
|
|
class PlaylistResponse(PlaylistBase):
|
|
"""Schema for playlist response."""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: UUID
|
|
user_id: UUID
|
|
track_count: int
|
|
total_duration: int
|
|
is_smart: bool
|
|
smart_rules: dict
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class PlaylistWithTracks(PlaylistResponse):
|
|
"""Schema for playlist with tracks."""
|
|
|
|
tracks: List[dict] = Field(default_factory=list)
|
|
|
|
|
|
class AddTrackRequest(BaseModel):
|
|
"""Schema for adding tracks to playlist."""
|
|
|
|
track_ids: List[UUID] = Field(..., min_length=1, max_length=100)
|
|
position: Optional[int] = None
|
|
|
|
|
|
class ReorderTracksRequest(BaseModel):
|
|
"""Schema for reordering tracks in playlist."""
|
|
|
|
track_id: UUID
|
|
new_position: int = Field(..., ge=0)
|
|
|
|
|
|
class PlaylistTrackResponse(BaseModel):
|
|
"""Schema for playlist track response."""
|
|
|
|
id: UUID
|
|
playlist_id: UUID
|
|
track_id: UUID
|
|
position: int
|
|
added_at: datetime
|
|
added_by: Optional[UUID] = None
|
|
track: Optional[dict] = None
|