Skip to content

Commit

Permalink
Merge pull request #69 from jphacks/feature/kind_shoe_select_message
Browse files Browse the repository at this point in the history
靴選択メッセージに靴を表示
  • Loading branch information
motty-mio2 authored Nov 18, 2023
2 parents 26db235 + 5f1a6f9 commit d7f8e9e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/kb_2315/backend/api/endpoints/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from linebot.v3.webhooks.models.source import Source

from kb_2315 import notify
from kb_2315.backend.crud import crud_session, crud_user
from kb_2315.backend.crud import crud_session, crud_shoe, crud_user
from kb_2315.backend.models.model_shoe import Shoe
from kb_2315.config import conf


Expand Down Expand Up @@ -77,10 +78,14 @@ async def handle_callback(request: Request) -> Literal["OK"]:
_, shoe_id, session_id = pbdata.split(":")

if crud_session.map_session_to_shoe(UUID(session_id), int(shoe_id)):
notify.line.send_message(
message="選択を保存しました",
send_to_id=return_id,
)
shoes: list[Shoe] = crud_shoe.search_shoe_by(shoe_id=int(shoe_id))

if len(shoes) > 0:
notify.line.send_message(
message=f"{shoes[0].name} を選択しました",
send_to_id=return_id,
)

else:
notify.line.send_message(
message="選択済みです",
Expand Down

0 comments on commit d7f8e9e

Please sign in to comment.