prod: UI Optimisée mise en production
- Documentation archivée et réorganisée - Backend: Ajout tests, migrations, library service, rate limiting - Frontend: Suppression Flutter, focus sur interface web HTML/JS - Tailwind CSS ajouté pour le style - Améliorations UX et corrections bugs Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -76,3 +76,10 @@ class RefreshTokenRequest(BaseModel):
|
||||
"""Schema for token refresh request."""
|
||||
|
||||
refresh_token: str
|
||||
|
||||
|
||||
class ChangePasswordRequest(BaseModel):
|
||||
"""Schema for password change request."""
|
||||
|
||||
old_password: str = Field(..., min_length=8, max_length=100)
|
||||
new_password: str = Field(..., min_length=8, max_length=100)
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
"""Library schemas."""
|
||||
from datetime import datetime
|
||||
from typing import Optional, List
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import BaseModel, Field, ConfigDict
|
||||
|
||||
|
||||
# ============ LISTENING HISTORY SCHEMAS ============
|
||||
|
||||
class ListeningHistoryBase(BaseModel):
|
||||
"""Base listening history schema."""
|
||||
|
||||
played_for: int = Field(..., ge=0, description="Duration played in seconds")
|
||||
completed: bool = False
|
||||
source: Optional[str] = Field(None, max_length=50, description="Playback source")
|
||||
|
||||
|
||||
class ListeningHistoryCreate(ListeningHistoryBase):
|
||||
"""Schema for creating a listening history entry."""
|
||||
|
||||
track_id: UUID
|
||||
|
||||
|
||||
class ListeningHistoryResponse(BaseModel):
|
||||
"""Schema for listening history response."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
user_id: UUID
|
||||
track_id: UUID
|
||||
played_for: int
|
||||
completed: bool
|
||||
source: Optional[str]
|
||||
played_at: datetime
|
||||
created_at: datetime
|
||||
|
||||
# Embedded track information
|
||||
track: Optional[dict] = None
|
||||
|
||||
|
||||
class ListeningHistoryStats(BaseModel):
|
||||
"""Schema for listening history statistics."""
|
||||
|
||||
total_plays: int
|
||||
plays_last_30_days: int
|
||||
unique_tracks_played: int
|
||||
|
||||
|
||||
# ============ LIKED TRACKS SCHEMAS ============
|
||||
|
||||
class LikedTrackBase(BaseModel):
|
||||
"""Base liked track schema."""
|
||||
|
||||
notes: Optional[str] = Field(None, max_length=1000, description="User notes about the track")
|
||||
|
||||
|
||||
class LikedTrackCreate(BaseModel):
|
||||
"""Schema for liking a track."""
|
||||
|
||||
track_id: UUID
|
||||
notes: Optional[str] = Field(None, max_length=1000)
|
||||
|
||||
|
||||
class LikedTrackUpdate(BaseModel):
|
||||
"""Schema for updating liked track notes."""
|
||||
|
||||
notes: str = Field(..., max_length=1000)
|
||||
|
||||
|
||||
class LikedTrackResponse(BaseModel):
|
||||
"""Schema for liked track response."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
user_id: UUID
|
||||
track_id: UUID
|
||||
notes: Optional[str]
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
# Embedded track information
|
||||
track: Optional[dict] = None
|
||||
|
||||
|
||||
class LikedTrackCheckResponse(BaseModel):
|
||||
"""Schema for checking if track is liked."""
|
||||
|
||||
is_liked: bool
|
||||
|
||||
|
||||
# ============ LIBRARY STATS SCHEMAS ============
|
||||
|
||||
class LibraryStatsResponse(BaseModel):
|
||||
"""Schema for library statistics response."""
|
||||
|
||||
liked_tracks_count: int
|
||||
total_plays: int
|
||||
plays_last_30_days: int
|
||||
unique_tracks_played: int
|
||||
|
||||
|
||||
class RecentlyPlayedResponse(BaseModel):
|
||||
"""Schema for recently played tracks."""
|
||||
|
||||
tracks: List[dict]
|
||||
total: int
|
||||
|
||||
|
||||
class MostPlayedTrackResponse(BaseModel):
|
||||
"""Schema for most played track response."""
|
||||
|
||||
track: dict
|
||||
play_count: int
|
||||
|
||||
|
||||
class MostPlayedTracksResponse(BaseModel):
|
||||
"""Schema for most played tracks response."""
|
||||
|
||||
tracks: List[MostPlayedTrackResponse]
|
||||
total: int
|
||||
Reference in New Issue
Block a user