Skip to content

Commit

Permalink
Merge pull request #49 from jphacks/feature/shoe_image
Browse files Browse the repository at this point in the history
Feature/shoe_image
  • Loading branch information
Hayatto9217 authored Nov 16, 2023
2 parents 523b93d + 6723b5b commit 34d3ba6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
33 changes: 33 additions & 0 deletions src/alembic/versions/2023_11_16_2220-6846ef0ccd9a_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""empty message
Revision ID: 6846ef0ccd9a
Revises: 861f09faff9c
Create Date: 2023-11-16 22:20:36.556485
"""
from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op


# revision identifiers, used by Alembic.
revision: str = "6846ef0ccd9a"
down_revision: Union[str, None] = "861f09faff9c"
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.alter_column("session", "device_id", existing_type=sa.INTEGER(), nullable=False)
op.add_column("shoe", sa.Column("image_url", sa.String(), nullable=False))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("shoe", "image_url")
op.alter_column("session", "device_id", existing_type=sa.INTEGER(), nullable=True)
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions src/kb_2315/backend/models/model_shoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
class Shoe(Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String, default="Shoe")
image_url: Mapped[str] = mapped_column(String, nullable=True)

sessions: Mapped[list[Session]] = relationship("Session", backref="event")
4 changes: 2 additions & 2 deletions src/kb_2315/notify/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def shoe_select_carousel(send_to_id: str = conf.line_group_id, session_id: UUID
columns_list: list[CarouselColumn] = []
shoes: list[Shoe] = crud_shoe.search_shoe_by()

for i, shoe in enumerate(shoes):
for shoe in shoes:
columns_list.append(
CarouselColumn(
text=f"靴 {shoe.name}",
thumbnail_image_url=f"https://picsum.photos/200/{300+i}",
thumbnail_image_url=shoe.image_url,
actions=[
PostbackAction(label=f"{shoe.name} を選ぶ", data=f"{shoe.id}:{session_id}"),
],
Expand Down

0 comments on commit 34d3ba6

Please sign in to comment.