Files
romm/backend/endpoints/responses/platform.py
Georges-Antoine Assi 4724361f6d refactor: remove per-platform cover aspect-ratio setting
The platform aspect_ratio setting is dropped from the UI and the API
(platform update body + response schema) — nothing consumed it for
rendering, and covers now size to their image's natural aspect.

- SettingsTab: remove the cover-style / aspect-ratio picker (and its
  now-dead helpers, CSS, and unused imports); collapse to a single column.
- update_platform: drop the `aspect_ratio` body field; PlatformSchema no
  longer returns it; utils/platforms stops seeding the default.
- Regenerate the affected frontend types (PlatformSchema, update body).

The DB column stays (out of the update/response scope; dropping it would
be a separate destructive migration) but is no longer read or written
through the API.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 17:43:40 -04:00

56 lines
1.5 KiB
Python

from pydantic import ConfigDict, Field, computed_field, field_validator
from .base import BaseModel, UTCDatetime
from .firmware import FirmwareSchema
class PlatformSchema(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
slug: str
fs_slug: str
rom_count: int
name: str
igdb_slug: str | None
moby_slug: str | None
hltb_slug: str | None
libretro_slug: str | None
custom_name: str | None = None
igdb_id: int | None = None
sgdb_id: int | None = None
moby_id: int | None = None
launchbox_id: int | None = None
ss_id: int | None = None
ra_id: int | None = None
hasheous_id: int | None = None
tgdb_id: int | None = None
flashpoint_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
firmware: list[FirmwareSchema] = Field(default_factory=list)
created_at: UTCDatetime
updated_at: UTCDatetime
fs_size_bytes: int
is_unidentified: bool
is_identified: bool
missing_from_fs: bool
@computed_field # type: ignore
@property
def display_name(self) -> str:
return self.custom_name or self.name
@computed_field # type: ignore
@property
def firmware_count(self) -> int:
return len(self.firmware)
@field_validator("firmware")
def sort_files(cls, v: list[FirmwareSchema]) -> list[FirmwareSchema]:
return sorted(v, key=lambda x: x.file_name)