29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
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)
|
|
|