diff --git a/backend/endpoints/responses/platform.py b/backend/endpoints/responses/platform.py index e352aba68..c19300312 100644 --- a/backend/endpoints/responses/platform.py +++ b/backend/endpoints/responses/platform.py @@ -11,7 +11,7 @@ class PlatformSchema(BaseModel): slug: str fs_slug: str rom_count: int - raw_name: str = Field(alias="name") + name: str custom_name: str | None = None igdb_id: int | None = None sgdb_id: int | None = None @@ -33,5 +33,5 @@ class PlatformSchema(BaseModel): @computed_field # type: ignore @property - def name(self) -> str: - return self.custom_name or self.raw_name + def display_name(self) -> str: + return self.custom_name or self.name diff --git a/frontend/src/__generated__/models/PlatformSchema.ts b/frontend/src/__generated__/models/PlatformSchema.ts index c3401eca6..3a4323391 100644 --- a/frontend/src/__generated__/models/PlatformSchema.ts +++ b/frontend/src/__generated__/models/PlatformSchema.ts @@ -10,8 +10,8 @@ export type PlatformSchema = { slug: string; fs_slug: string; rom_count: number; - readonly name: string; - custom_name?: (string | null); + name: string; + custom_name: (string | null); igdb_id?: (number | null); sgdb_id?: (number | null); moby_id?: (number | null); @@ -26,5 +26,6 @@ export type PlatformSchema = { aspect_ratio?: string; created_at: string; updated_at: string; + readonly display_name: string; }; diff --git a/frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue b/frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue index 62e3d5556..6bf309daa 100644 --- a/frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue +++ b/frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue @@ -15,6 +15,7 @@ import { storeToRefs } from "pinia"; import { computed, inject, ref, watch } from "vue"; import { useDisplay } from "vuetify"; import { useI18n } from "vue-i18n"; +import type { Platform } from "@/stores/platforms"; // Props const { t } = useI18n(); @@ -66,13 +67,13 @@ function toggleEditable() { async function updatePlatform() { if (!updatedPlatform.value) return; - const { data: platform } = await platformApi + await platformApi .updatePlatform({ - platform: updatedPlatform.value, + platform: updatedPlatform.value as Platform, }) - .then(({ data }) => { + .then(({ data: platform }) => { emitter?.emit("snackbarShow", { - msg: data.msg, + msg: "Platform updated successfully", icon: "mdi-check-bold", color: "green", }); @@ -140,7 +141,7 @@ watch( if (aspectRatio) { // Find the index of the aspect ratio option that matches the current aspect ratio const defaultAspectRatio = aspectRatioOptions.value.findIndex( - (option) => option.name == aspectRatio + (option) => option.name == aspectRatio, ); // If a matching aspect ratio option is found, update the selectedAspectRatio if (defaultAspectRatio !== -1) { @@ -148,7 +149,7 @@ watch( } } }, - { immediate: true } // Execute the callback immediately with the current value + { immediate: true }, // Execute the callback immediately with the current value ); @@ -175,7 +176,7 @@ watch( v-if="auth.scopes.includes('platforms.write')" >
- {{ currentPlatform.name }} + {{ currentPlatform.display_name }}
(), { {{ platform.name }}{{ platform.display_name }}