Skip to content

Commit

Permalink
update backend
Browse files Browse the repository at this point in the history
  • Loading branch information
motty-mio2 committed Nov 9, 2023
1 parent 165f300 commit 68a39bd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/kb_2315/backend/api/endpoints/line.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from typing import Literal, cast
from uuid import UUID

from fastapi import APIRouter, HTTPException, Request
from linebot.v3.exceptions import InvalidSignatureError
Expand All @@ -9,6 +10,7 @@
from linebot.v3.webhooks.models.source import Source

from kb_2315 import notify
from kb_2315.backend.crud import crud_session
from kb_2315.config import conf


Expand Down Expand Up @@ -57,4 +59,24 @@ async def handle_callback(request: Request) -> Literal["OK"]:
if return_id is None:
continue

if event.type == "postback":
pbdata: str = event.postback.data # type: ignore
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,
)
else:
notify.line.send_message(
message="選択済みです",
send_to_id=return_id,
)
else:
notify.line.send_message(
message="hello",
send_to_id=return_id,
)

return "OK"

0 comments on commit 68a39bd

Please sign in to comment.