Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Added gameItemId to identified items

Revision ID: cc39d4eb113b
Revises: e38727349f3f
Create Date: 2025-10-25 22:26:59.343322

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "cc39d4eb113b"
down_revision: Union[str, None] = "e38727349f3f"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("item", sa.Column("gameItemId", sa.Text(), nullable=True))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("item", "gameItemId")
# ### end Alembic commands ###
3 changes: 2 additions & 1 deletion src/backend_api/app/core/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ class Item(_ItemBase, Base):
# Hypertable
# For hypertable specs, see alembic revision `cc29b89156db'
__tablename__ = "item"

# TODO do something about None and make it not nullable
gameItemId: Mapped[str | None] = mapped_column(Text)
prefixes: Mapped[int | None] = mapped_column(SmallInteger)
suffixes: Mapped[int | None] = mapped_column(SmallInteger)
foilVariation: Mapped[int | None] = mapped_column(SmallInteger)
Expand Down
1 change: 1 addition & 0 deletions src/backend_api/app/core/schemas/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class _BaseItem(_pydantic.BaseModel):
itemBaseTypeId: int
ilvl: int
rarity: str
gameItemId: str | None = None
identified: bool = True
currencyAmount: float | None = None
currencyId: int | None = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _create_item_table(
"""
self.item_columns = [
"itemId",
"id",
"name",
"league",
"baseType",
Expand Down Expand Up @@ -144,8 +145,8 @@ def transform_influences(row: pd.DataFrame, influence_columns: list[str]):
if "extended.suffixes" in item_df.columns:
rename_extended_map["extended.suffixes"] = "suffixes"

if rename_extended_map:
item_df = item_df.rename(columns=rename_extended_map)
rename_map = {**rename_extended_map, "id": "gameItemId"}
item_df = item_df.rename(columns=rename_map)

stash_series = item_df["stash"].str.split(" ")
currency_series = item_df["note"].str.split(" ")
Expand Down Expand Up @@ -192,6 +193,7 @@ def item_table_columns_to_not_drop(self) -> set[str]:
dont_drop_columns = self._item_table_columns_to_not_drop
except AttributeError:
dont_drop_columns = {
"gameItemId",
"name",
"league",
"itemBaseTypeId",
Expand Down
Loading