evaluate sqlmodel
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from sqlmodel import Field, Relationship, table
|
||||
from uuid import UUID
|
||||
from .base import AbstractEntity
|
||||
|
||||
|
||||
|
||||
class MediaActorFile(AbstractEntity, table=True):
|
||||
__tablename__ = "media_actor_file"
|
||||
|
||||
media_actor_id: UUID = Field(nullable=False, foreign_key="media_actor.id")
|
||||
media_file_id: UUID = Field(nullable=False, foreign_key="media_file.id")
|
||||
|
||||
|
||||
class MediaFile(AbstractEntity, table=True):
|
||||
__tablename__ = "media_file"
|
||||
cloud_link: str = Field(nullable=True, max_length=255)
|
||||
file_name: str = Field(nullable=True, max_length=255)
|
||||
path : str = Field(nullable=True, max_length=255)
|
||||
title: str = Field(nullable=True, max_length=255)
|
||||
url: str = Field(nullable=True, max_length=255)
|
||||
actors : list["MediaActor"] = Relationship(back_populates="videos", link_model=MediaActorFile)
|
||||
|
||||
|
||||
class MediaActor(AbstractEntity, table=True):
|
||||
__tablename__ = "media_actor"
|
||||
name: str = Field(nullable=True, max_length=255)
|
||||
videos : list["MediaFile"] = Relationship(back_populates="actors", link_model=MediaActorFile)
|
||||
|
||||
Reference in New Issue
Block a user