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:
@@ -8,6 +8,8 @@ from app.models.base import BaseModel
|
||||
if TYPE_CHECKING:
|
||||
from app.models.plan import Plan
|
||||
from app.models.playlist import Playlist
|
||||
from app.models.sound_played import SoundPlayed
|
||||
from app.models.stream import Stream
|
||||
from app.models.user_oauth import UserOauth
|
||||
|
||||
|
||||
@@ -29,3 +31,5 @@ class User(BaseModel, table=True):
|
||||
oauths: list["UserOauth"] = Relationship(back_populates="user")
|
||||
plan: "Plan" = Relationship(back_populates="users")
|
||||
playlists: list["Playlist"] = Relationship(back_populates="user")
|
||||
sounds_played: list["SoundPlayed"] = Relationship(back_populates="user")
|
||||
streams: list["Stream"] = Relationship(back_populates="user")
|
||||
|
||||
Reference in New Issue
Block a user