Files
romm/backend/endpoints/responses/firmware.py
Spinnich 3e02fb94ff fix(firmware): let missing firmware be found and cleaned up
A scan flags firmware whose file vanished, but nothing could act on the
flag: stale BIOS entries could only be found by opening each platform's
Firmware tab one at a time, the player still offered them (auto-selecting
the sole entry, so the game failed to boot with nothing pointing at the
BIOS), and platform firmware counts included them.

Adds a `missing` filter to the firmware list endpoint, a
`cleanup_missing_firmware` manual task alongside the ROM one, and a
Missing firmware tab in Library management that lists every flagged entry
library-wide with a bulk cleanup. The player now asks for present
firmware only, and firmware selection moved to a `playerFirmware` util
that never picks a missing entry. `firmware_count` counts only firmware
present on disk; the rows themselves still ship so the Firmware tab can
strike them through.

`FirmwareSchema` gains `platform_id` so the library-wide list can group
by platform.

Fixes #4075

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 23:52:21 +00:00

36 lines
640 B
Python

from typing import TypedDict
from pydantic import ConfigDict
from .base import BaseModel, UTCDatetime
class FirmwareSchema(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
platform_id: int
file_name: str
file_name_no_tags: str
file_name_no_ext: str
file_extension: str
file_path: str
file_size_bytes: int
full_path: str
is_verified: bool
crc_hash: str
md5_hash: str
sha1_hash: str
missing_from_fs: bool
created_at: UTCDatetime
updated_at: UTCDatetime
class AddFirmwareResponse(TypedDict):
uploaded: int
firmware: list[FirmwareSchema]