Skip to content

Commit 7a04386

Browse files
authored
Merge pull request #2473 from rommapp/hotfix-platform-slugs
Set platform metadata slugs on models in DB
2 parents c876ff5 + 3c88095 commit 7a04386

File tree

7 files changed

+79
-18
lines changed

7 files changed

+79
-18
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""empty message
2+
3+
Revision ID: 0054_add_platform_metadata_slugs
4+
Revises: 0053_add_hltb_metadata
5+
Create Date: 2025-09-22 21:42:33.654137
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "0054_add_platform_metadata_slugs"
14+
down_revision = "0053_add_hltb_metadata"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade() -> None:
20+
with op.batch_alter_table("platforms", schema=None) as batch_op:
21+
batch_op.add_column(sa.Column("flashpoint_id", sa.Integer(), nullable=True))
22+
batch_op.add_column(
23+
sa.Column("igdb_slug", sa.String(length=100), nullable=True)
24+
)
25+
batch_op.add_column(
26+
sa.Column("moby_slug", sa.String(length=100), nullable=True)
27+
)
28+
batch_op.add_column(
29+
sa.Column("hltb_slug", sa.String(length=100), nullable=True)
30+
)
31+
32+
33+
def downgrade() -> None:
34+
with op.batch_alter_table("platforms", schema=None) as batch_op:
35+
batch_op.drop_column("hltb_slug")
36+
batch_op.drop_column("moby_slug")
37+
batch_op.drop_column("igdb_slug")
38+
batch_op.drop_column("flashpoint_id")

backend/endpoints/responses/platform.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class PlatformSchema(BaseModel):
1616
name: str
1717
igdb_slug: str | None
1818
moby_slug: str | None
19+
hltb_slug: str | None
1920
custom_name: str | None = None
2021
igdb_id: int | None = None
2122
sgdb_id: int | None = None
@@ -25,6 +26,7 @@ class PlatformSchema(BaseModel):
2526
ra_id: int | None = None
2627
hasheous_id: int | None = None
2728
tgdb_id: int | None = None
29+
flashpoint_id: int | None = None
2830
category: str | None = None
2931
generation: int | None = None
3032
family_name: str | None = None

backend/handler/scan_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ async def scan_platform(
176176
platform_attrs["name"] = platform_attrs["slug"].replace("-", " ").title()
177177
platform_attrs.update(
178178
{
179-
**hasheous_platform,
179+
**hltb_platform,
180+
**flashpoint_platform,
180181
**tgdb_platform,
182+
**hasheous_platform,
181183
**launchbox_platform,
182184
**ra_platform,
183185
**moby_platform,

backend/models/platform.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from functools import cached_property
43
from typing import TYPE_CHECKING
54

65
from sqlalchemy import String, func, select
@@ -28,6 +27,10 @@ class Platform(BaseModel):
2827
launchbox_id: Mapped[int | None]
2928
hasheous_id: Mapped[int | None]
3029
tgdb_id: Mapped[int | None]
30+
flashpoint_id: Mapped[int | None]
31+
igdb_slug: Mapped[str | None]
32+
moby_slug: Mapped[str | None]
33+
hltb_slug: Mapped[str | None]
3134
slug: Mapped[str] = mapped_column(String(length=100))
3235
fs_slug: Mapped[str] = mapped_column(String(length=100))
3336
name: Mapped[str] = mapped_column(String(length=400))
@@ -83,21 +86,5 @@ def is_unidentified(self) -> bool:
8386
def is_identified(self) -> bool:
8487
return not self.is_unidentified
8588

86-
@cached_property
87-
def igdb_slug(self) -> str | None:
88-
from handler.metadata import meta_igdb_handler
89-
90-
igdb_platform = meta_igdb_handler.get_platform(self.slug)
91-
92-
return igdb_platform.get("igdb_slug", None)
93-
94-
@cached_property
95-
def moby_slug(self) -> str | None:
96-
from handler.metadata import meta_moby_handler
97-
98-
moby_platform = meta_moby_handler.get_platform(self.slug)
99-
100-
return moby_platform.get("moby_slug", None)
101-
10289
def __repr__(self) -> str:
10390
return self.name

frontend/src/__generated__/models/PlatformSchema.ts

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,26 @@ watch(
413413
<span>{{ currentPlatform.hasheous_id }}</span>
414414
</v-chip>
415415
</a>
416+
<v-chip
417+
v-if="currentPlatform.flashpoint_id"
418+
class="px-0 ml-1 mt-1"
419+
size="small"
420+
title="Flashpoint"
421+
>
422+
<v-avatar class="bg-surface" size="30" rounded="0">
423+
<v-img src="/assets/scrappers/flashpoint.png" />
424+
</v-avatar>
425+
</v-chip>
426+
<v-chip
427+
v-if="currentPlatform.hltb_slug"
428+
class="px-0 ml-1 mt-1"
429+
size="small"
430+
title="HLTB"
431+
>
432+
<v-avatar class="bg-surface" size="30" rounded="0">
433+
<v-img src="/assets/scrappers/hltb.png" />
434+
</v-avatar>
435+
</v-chip>
416436
</v-col>
417437
</v-row>
418438
<v-card class="mt-4 bg-toplayer fill-width" elevation="0">

frontend/src/components/common/Game/VirtualTable.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ function updateOptions({ sortBy }: { sortBy: SortBy }) {
249249
<v-img src="/assets/scrappers/ra.png" />
250250
</v-avatar>
251251
</v-chip>
252+
<v-chip
253+
v-if="item.flashpoint_id"
254+
class="mr-1 pa-0 item-chip"
255+
size="x-small"
256+
title="Flashpoint match"
257+
>
258+
<v-avatar size="20" rounded>
259+
<v-img src="/assets/scrappers/flashpoint.png" />
260+
</v-avatar>
261+
</v-chip>
252262
<v-chip
253263
v-if="item.hltb_id"
254264
class="mr-1 pa-0 item-chip"

0 commit comments

Comments
 (0)