Files
sdb2-backend/app/models/sound_played.py
JSC dd10ef5d41 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.
2025-07-30 20:46:49 +02:00

23 lines
662 B
Python

from typing import TYPE_CHECKING
from sqlmodel import Field, Relationship
from app.models.base import BaseModel
if TYPE_CHECKING:
from app.models.sound import Sound
from app.models.user import User
class SoundPlayed(BaseModel, table=True):
"""Database model for a sound played."""
__tablename__ = "sound_played" # pyright: ignore[reportAssignmentType]
user_id: int | None = Field(foreign_key="user.id", nullable=True)
sound_id: int = Field(foreign_key="sound.id", nullable=False)
# relationships
user: "User" = Relationship(back_populates="sounds_played")
sound: "Sound" = Relationship(back_populates="play_history")