From 324932184afb1e897493fea921a0ed5de7bd453a Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 2 Dec 2025 10:32:17 -0500 Subject: [PATCH 1/3] Move merged_screenshots and merged_ra_metadata to simple RomSchema --- backend/endpoints/responses/rom.py | 6 ++---- backend/models/rom.py | 2 +- frontend/src/__generated__/models/DetailedRomSchema.ts | 4 ---- .../src/__generated__/models/RomGamelistMetadata.ts | 10 +++++----- frontend/src/__generated__/models/RomSSMetadata.ts | 2 ++ frontend/src/__generated__/models/SimpleRomSchema.ts | 7 +++---- frontend/src/__generated__/models/UserNoteSchema.ts | 5 +---- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/backend/endpoints/responses/rom.py b/backend/endpoints/responses/rom.py index 3a4ef5855..d7ce42570 100644 --- a/backend/endpoints/responses/rom.py +++ b/backend/endpoints/responses/rom.py @@ -261,8 +261,6 @@ class RomSchema(BaseModel): md5_hash: str | None sha1_hash: str | None - # TODO: Remove this after 4.3 release - multi: Annotated[bool, Field(deprecated="Replaced by has_multiple_files")] has_simple_single_file: bool has_nested_single_file: bool has_multiple_files: bool @@ -274,6 +272,8 @@ class RomSchema(BaseModel): siblings: list[SiblingRomSchema] rom_user: RomUserSchema + merged_screenshots: list[str] + merged_ra_metadata: RomRAMetadata | None class Config: from_attributes = True @@ -360,8 +360,6 @@ class UserCollectionSchema(BaseModel): class DetailedRomSchema(RomSchema): - merged_ra_metadata: RomRAMetadata | None - merged_screenshots: list[str] user_saves: list[SaveSchema] user_states: list[StateSchema] user_screenshots: list[ScreenshotSchema] diff --git a/backend/models/rom.py b/backend/models/rom.py index 90af0e00a..3ff7d9676 100644 --- a/backend/models/rom.py +++ b/backend/models/rom.py @@ -385,7 +385,7 @@ class Rom(BaseModel): or [] ) - @property + @cached_property def merged_ra_metadata(self) -> dict[str, list] | None: if self.ra_metadata and "achievements" in self.ra_metadata: for achievement in self.ra_metadata.get("achievements", []): diff --git a/frontend/src/__generated__/models/DetailedRomSchema.ts b/frontend/src/__generated__/models/DetailedRomSchema.ts index 547b1d3a6..41f992f05 100644 --- a/frontend/src/__generated__/models/DetailedRomSchema.ts +++ b/frontend/src/__generated__/models/DetailedRomSchema.ts @@ -74,10 +74,6 @@ export type DetailedRomSchema = { crc_hash: (string | null); md5_hash: (string | null); sha1_hash: (string | null); - /** - * @deprecated - */ - multi: boolean; has_simple_single_file: boolean; has_nested_single_file: boolean; has_multiple_files: boolean; diff --git a/frontend/src/__generated__/models/RomGamelistMetadata.ts b/frontend/src/__generated__/models/RomGamelistMetadata.ts index e7702cdbd..7000eb61f 100644 --- a/frontend/src/__generated__/models/RomGamelistMetadata.ts +++ b/frontend/src/__generated__/models/RomGamelistMetadata.ts @@ -16,11 +16,6 @@ export type RomGamelistMetadata = { thumbnail_url?: (string | null); title_screen_url?: (string | null); video_url?: (string | null); - box3d_path?: (string | null); - miximage_path?: (string | null); - physical_path?: (string | null); - marquee_path?: (string | null); - video_path?: (string | null); rating?: (number | null); first_release_date?: (string | null); companies?: (Array | null); @@ -28,5 +23,10 @@ export type RomGamelistMetadata = { genres?: (Array | null); player_count?: (string | null); md5_hash?: (string | null); + box3d_path?: (string | null); + miximage_path?: (string | null); + physical_path?: (string | null); + marquee_path?: (string | null); + video_path?: (string | null); }; diff --git a/frontend/src/__generated__/models/RomSSMetadata.ts b/frontend/src/__generated__/models/RomSSMetadata.ts index c966dd5e0..2bbb83469 100644 --- a/frontend/src/__generated__/models/RomSSMetadata.ts +++ b/frontend/src/__generated__/models/RomSSMetadata.ts @@ -21,7 +21,9 @@ export type RomSSMetadata = { video_url?: (string | null); video_normalized_url?: (string | null); bezel_path?: (string | null); + box2d_back_path?: (string | null); box3d_path?: (string | null); + fanart_path?: (string | null); miximage_path?: (string | null); physical_path?: (string | null); marquee_path?: (string | null); diff --git a/frontend/src/__generated__/models/SimpleRomSchema.ts b/frontend/src/__generated__/models/SimpleRomSchema.ts index 20fe834fc..f1ac66722 100644 --- a/frontend/src/__generated__/models/SimpleRomSchema.ts +++ b/frontend/src/__generated__/models/SimpleRomSchema.ts @@ -11,6 +11,7 @@ import type { RomIGDBMetadata } from './RomIGDBMetadata'; import type { RomLaunchboxMetadata } from './RomLaunchboxMetadata'; import type { RomMetadataSchema } from './RomMetadataSchema'; import type { RomMobyMetadata } from './RomMobyMetadata'; +import type { RomRAMetadata } from './RomRAMetadata'; import type { RomSSMetadata } from './RomSSMetadata'; import type { RomUserSchema } from './RomUserSchema'; import type { SiblingRomSchema } from './SiblingRomSchema'; @@ -68,10 +69,6 @@ export type SimpleRomSchema = { crc_hash: (string | null); md5_hash: (string | null); sha1_hash: (string | null); - /** - * @deprecated - */ - multi: boolean; has_simple_single_file: boolean; has_nested_single_file: boolean; has_multiple_files: boolean; @@ -82,5 +79,7 @@ export type SimpleRomSchema = { missing_from_fs: boolean; siblings: Array; rom_user: RomUserSchema; + merged_ra_metadata: (RomRAMetadata | null); + merged_screenshots: Array; }; diff --git a/frontend/src/__generated__/models/UserNoteSchema.ts b/frontend/src/__generated__/models/UserNoteSchema.ts index adf1f5810..b4ef9a531 100644 --- a/frontend/src/__generated__/models/UserNoteSchema.ts +++ b/frontend/src/__generated__/models/UserNoteSchema.ts @@ -7,10 +7,7 @@ export type UserNoteSchema = { title: string; content: string; is_public: boolean; - tags?: Array | null; - metadata?: Record | null; - shared_with_users?: Array | null; - collaboration_level?: string | null; + tags?: (Array | null); created_at: string; updated_at: string; user_id: number; From 141cd14559ea7a72eb5abeb321fb99cc2cb9721a Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 2 Dec 2025 10:41:16 -0500 Subject: [PATCH 2/3] cleanup --- backend/endpoints/responses/rom.py | 4 ++-- backend/tests/handler/test_fastapi.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/endpoints/responses/rom.py b/backend/endpoints/responses/rom.py index d7ce42570..fcbefac38 100644 --- a/backend/endpoints/responses/rom.py +++ b/backend/endpoints/responses/rom.py @@ -2,10 +2,10 @@ from __future__ import annotations import re from datetime import datetime, timezone -from typing import Annotated, NotRequired, TypedDict, get_type_hints +from typing import TypedDict, get_type_hints from fastapi import Request -from pydantic import Field, computed_field, field_validator +from pydantic import computed_field, field_validator from endpoints.responses.assets import SaveSchema, ScreenshotSchema, StateSchema from handler.metadata.flashpoint_handler import FlashpointMetadata diff --git a/backend/tests/handler/test_fastapi.py b/backend/tests/handler/test_fastapi.py index b7964d3e0..6eb94649d 100644 --- a/backend/tests/handler/test_fastapi.py +++ b/backend/tests/handler/test_fastapi.py @@ -82,7 +82,7 @@ async def test_scan_rom(): assert type(rom) is Rom assert rom.fs_name == "Paper Mario (USA).z64" - assert rom.name == "Paper Mario" + # assert rom.name == "Paper Mario" assert rom.fs_path == "n64/Paper Mario (USA)" assert rom.igdb_id == 3340 assert rom.hasheous_id == 4872 From dd3ed855deb6f44fa2a2d03f6cd33004535073a6 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 2 Dec 2025 10:45:15 -0500 Subject: [PATCH 3/3] add back import --- backend/endpoints/responses/rom.py | 2 +- backend/tests/handler/test_fastapi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/endpoints/responses/rom.py b/backend/endpoints/responses/rom.py index fcbefac38..5249f0cb8 100644 --- a/backend/endpoints/responses/rom.py +++ b/backend/endpoints/responses/rom.py @@ -2,7 +2,7 @@ from __future__ import annotations import re from datetime import datetime, timezone -from typing import TypedDict, get_type_hints +from typing import NotRequired, TypedDict, get_type_hints from fastapi import Request from pydantic import computed_field, field_validator diff --git a/backend/tests/handler/test_fastapi.py b/backend/tests/handler/test_fastapi.py index 6eb94649d..b7964d3e0 100644 --- a/backend/tests/handler/test_fastapi.py +++ b/backend/tests/handler/test_fastapi.py @@ -82,7 +82,7 @@ async def test_scan_rom(): assert type(rom) is Rom assert rom.fs_name == "Paper Mario (USA).z64" - # assert rom.name == "Paper Mario" + assert rom.name == "Paper Mario" assert rom.fs_path == "n64/Paper Mario (USA)" assert rom.igdb_id == 3340 assert rom.hasheous_id == 4872