21 lines
619 B
Python
21 lines
619 B
Python
from typing import Literal, Optional, TYPE_CHECKING
|
|
from sqlmodel import Field, SQLModel, Relationship
|
|
|
|
if TYPE_CHECKING:
|
|
from diyalgo.models import Status
|
|
|
|
class MediaAttachment(SQLModel, table=True):
|
|
id: int = Field(primary_key=True)
|
|
blurhash: str
|
|
description: str
|
|
# meta: dict
|
|
preview_url: str
|
|
remote_url: str
|
|
type: str #Literal['unknown', 'image', 'gifv', 'video', 'audio']
|
|
url: str
|
|
status_id: Optional[int] = Field(default=None, foreign_key='status.id')
|
|
status: 'Status' = Relationship(back_populates='media_attachments')
|
|
|
|
# class Config:
|
|
# extra = 'ignore'
|