Files
romm/backend/endpoints/responses/platform.py
Georges-Antoine Assi ebc91b0502 fix bad git push
2025-01-09 21:10:20 -05:00

39 lines
1009 B
Python

from datetime import datetime
from models.platform import DEFAULT_COVER_ASPECT_RATIO
from pydantic import Field, computed_field
from .base import BaseModel
from .firmware import FirmwareSchema
class PlatformSchema(BaseModel):
id: int
slug: str
fs_slug: str
rom_count: int
name: str
custom_name: str | None = None
igdb_id: int | None = None
sgdb_id: int | None = None
moby_id: int | None = None
category: str | None = None
generation: int | None = None
family_name: str | None = None
family_slug: str | None = None
url: str | None = None
url_logo: str | None = None
logo_path: str | None = None
firmware: list[FirmwareSchema] = Field(default_factory=list)
aspect_ratio: str = DEFAULT_COVER_ASPECT_RATIO
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
@computed_field # type: ignore
@property
def display_name(self) -> str:
return self.custom_name or self.name