Files
romm/backend/models
danielcopper e304e08a88 perf(roms): let a list fetch leave the provider metadata off each item (#5228)
* perf(roms): let a list fetch leave the provider metadata off each item

GET /api/roms takes with_provider_metadata, default true. When it is
false, every *_metadata field but manual_metadata (the twelve provider
blobs and merged_ra_metadata) comes back null. The fields stay in the
schema, so the response shape is unchanged. metadatum and the flat
fields read from the blobs (alternative_names, youtube_video_id,
path_video) are serialized as before.

The fields are nulled on a copy of the finished schema rather than on
the Rom, because an assignment to the row inside the request's session
would be flushed to the database. The set of fields is derived from the
schema, and a test pins the names, so a new *_metadata field joins on
purpose.

Closes #5227

* refactor(roms): list the provider metadata columns in one place

PROVIDER_METADATA_COLUMNS on the model now backs the scan snapshot, the
unmatch reset and the list endpoint's opt-out, which each spelled out the
thirteen columns. The opt-out test is cut down to one request per mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(roms): spell out the RetroAchievements field in the opt-out

The response set is now the provider columns less ra_metadata, plus
merged_ra_metadata, which the schema serves with absolute badge paths.
The nulling reads as one conditional step before the return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(roms): copy only the achievement dicts in merged_ra_metadata

The deep copy cloned the whole RetroAchievements blob to rewrite two badge
paths per achievement. Building new achievement dicts keeps the stored
paths relative at a quarter of the cost: 24.2 ms to 6.3 ms over a 500-item
page of a real library, with identical output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 08:33:51 -04:00
..
2026-07-23 14:44:56 -04:00
2026-03-14 23:35:04 -04:00