Add database seeding functionality and enhance model relationships

- Implement initial data seeding for plans in the database.
- Create a new `seed_all_data` function to manage seeding process.
- Update `Sound` and `User` models to include relationships for `SoundPlayed` and `Stream`.
This commit is contained in:
JSC
2025-07-25 11:44:47 +02:00
parent 4a77a23ee5
commit af20bc8724
4 changed files with 85 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ from app.models.base import BaseModel
if TYPE_CHECKING:
from app.models.playlist_sound import PlaylistSound
from app.models.sound_played import SoundPlayed
from app.models.stream import Stream
@@ -31,3 +32,4 @@ class Sound(BaseModel, table=True):
# relationships
playlist_sounds: list["PlaylistSound"] = Relationship(back_populates="sound")
streams: list["Stream"] = Relationship(back_populates="sound")
play_history: list["SoundPlayed"] = Relationship(back_populates="sound")