mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 23:42:07 +01:00
Merge pull request #2744 from rommapp/merged-screenshots-simple-rom
Move merged_screenshots and merged_ra_metadata to simple RomSchema
This commit is contained in:
@@ -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 NotRequired, 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
|
||||
@@ -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]
|
||||
|
||||
@@ -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", []):
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<string> | null);
|
||||
@@ -28,5 +23,10 @@ export type RomGamelistMetadata = {
|
||||
genres?: (Array<string> | 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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<SiblingRomSchema>;
|
||||
rom_user: RomUserSchema;
|
||||
merged_ra_metadata: (RomRAMetadata | null);
|
||||
merged_screenshots: Array<string>;
|
||||
};
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@ export type UserNoteSchema = {
|
||||
title: string;
|
||||
content: string;
|
||||
is_public: boolean;
|
||||
tags?: Array<string> | null;
|
||||
metadata?: Record<string, any> | null;
|
||||
shared_with_users?: Array<number> | null;
|
||||
collaboration_level?: string | null;
|
||||
tags?: (Array<string> | null);
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
user_id: number;
|
||||
|
||||
Reference in New Issue
Block a user