feat: Add VLC player API endpoints and associated tests
- Implemented VLC player API endpoints for playing and stopping sounds. - Added tests for successful playback, error handling, and authentication scenarios. - Created utility function to get sound file paths based on sound properties. - Refactored player service to utilize shared sound path utility. - Enhanced test coverage for sound file path utility with various sound types. - Introduced tests for VLC player service, including subprocess handling and play count tracking.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlmodel import Field, Relationship, UniqueConstraint
|
||||
from sqlmodel import Field, Relationship
|
||||
|
||||
from app.models.base import BaseModel
|
||||
|
||||
@@ -14,18 +14,9 @@ class SoundPlayed(BaseModel, table=True):
|
||||
|
||||
__tablename__ = "sound_played" # pyright: ignore[reportAssignmentType]
|
||||
|
||||
user_id: int = Field(foreign_key="user.id", nullable=False)
|
||||
user_id: int | None = Field(foreign_key="user.id", nullable=True)
|
||||
sound_id: int = Field(foreign_key="sound.id", nullable=False)
|
||||
|
||||
# constraints
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"user_id",
|
||||
"sound_id",
|
||||
name="uq_sound_played_user_sound",
|
||||
),
|
||||
)
|
||||
|
||||
# relationships
|
||||
user: "User" = Relationship(back_populates="sounds_played")
|
||||
sound: "Sound" = Relationship(back_populates="play_history")
|
||||
|
||||
Reference in New Issue
Block a user