merge: origin/main(카톡 승인 알림 Event API) 을 fix/agent-multi-action 에 병합
충돌은 tests/test_kakao_webhook.py 하나 — 양쪽이 파일 끝에 서로 다른 테스트를 붙였다. 둘 다 살렸다(여러 가게·확인 경로 테스트 → 승인 알림 테스트 순). channel.py 는 자동 병합 — 저쪽은 approval_notice·approve_post 추가와 _say 선택 인자 확장이라 이쪽의 _pick_place·확인 경로 변경과 겹치지 않는다. 전체 994 passed / 47 failed — 실패 목록은 병합 전과 동일(gemini·openai 키 미설정, search_console, weather_notes) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
273efb717f
14 files changed
+1163
-29
No files matched your search
@@ -14,13 +14,14 @@
|
||||
import re
|
||||
import uuid
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from urllib.parse import quote
|
||||
|
||||
from sqlalchemy import select
|
||||
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import owner_kakao_links as Link
|
||||
from common.database.model.models import users
|
||||
from common.enums import DBWRType, ErrorType, KakaoLinkStatus
|
||||
from common.database.model.models import place_posts, places, users
|
||||
from common.enums import DBWRType, ErrorType, KakaoLinkStatus, PostStatus
|
||||
from common.models.gmodel import UserInfo
|
||||
from crud.place_crud import PlaceCRUD
|
||||
from crud.site_crud import SiteCRUD
|
||||
@@ -28,8 +29,9 @@ from crud.job_crud import JobQueue
|
||||
from common.enums import SiteStatus
|
||||
from common.models.gmodel import PageParams
|
||||
from services.site_service import SiteService
|
||||
from services import kakao_link_service as link_service
|
||||
from services import blog_service, kakao_link_service as link_service
|
||||
from services.agent import runtime
|
||||
from services.post_service import PostService
|
||||
from services.agent.tools import REGISTRY
|
||||
from services.kakao_link_service import KakaoLinkError
|
||||
|
||||
@@ -60,9 +62,14 @@ def _now():
|
||||
return datetime.now(timezone.utc)
|
||||
|
||||
|
||||
def _say(text: str, quick: list[str] | None = None) -> dict:
|
||||
"""채널이 모르는 모양으로 답한다 — 문구와 바로가기 목록뿐이다."""
|
||||
return {"text": text, "quick_replies": quick or []}
|
||||
def _say(text: str, quick: list[str] | None = None, links: list[dict] | None = None,
|
||||
approve_post_id: str | None = None, hint: str | None = None) -> dict:
|
||||
"""채널이 모르는 모양으로 답한다 — 문구, 바로가기 목록, 링크 버튼({label, url}),
|
||||
승인 버튼을 달 글 ID, 버튼 위에 붙는 한 줄 안내뿐이다. 버튼을 어떻게 그릴지는 채널 몫이다."""
|
||||
return {
|
||||
"text": text, "quick_replies": quick or [], "links": links or [],
|
||||
"approve_post_id": approve_post_id, "hint": hint,
|
||||
}
|
||||
|
||||
|
||||
async def _user_info(user_id) -> UserInfo | None:
|
||||
@@ -313,6 +320,117 @@ async def handle(utterance: str, channel_user_key: str) -> dict:
|
||||
return _say(result["reply"], quick)
|
||||
|
||||
|
||||
# 승인 알림에서 보여줄 수 있는 글 = 아직 사이트에 안 올린 글. 메일 승인 링크와 같은 범위다
|
||||
# (검수 통과 REVIEWED · 메일/카톡이 나간 SENT).
|
||||
_APPROVABLE = (PostStatus.REVIEWED.value, PostStatus.SENT.value)
|
||||
|
||||
|
||||
async def _owned_pending_post(user_id, post_id: str):
|
||||
"""(글, 가게 이름) — **이 사장님 가게의**, 아직 안 올린, 기한이 안 지난 글일 때만. 아니면 None.
|
||||
|
||||
★ 글 ID 는 카카오가 이벤트 params 로 실어 온 값이지만 믿지 않는다. 발화자 키 → user_id 로
|
||||
찾은 사장님이 그 글이 달린 가게의 주인인지를 여기서 다시 본다 — 글 ID 만 알면 남의 글이
|
||||
보이는 구멍이 되면 안 된다(없는 글과 남의 글을 같은 답으로 돌려준다)."""
|
||||
try:
|
||||
pid = uuid.UUID(str(post_id))
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
async def run(s):
|
||||
row = (
|
||||
await s.execute(
|
||||
select(place_posts, places.name)
|
||||
.join(places, places.place_id == place_posts.place_id)
|
||||
.where(
|
||||
place_posts.post_id == pid,
|
||||
place_posts.deleted.is_(False),
|
||||
place_posts.status.in_(_APPROVABLE),
|
||||
places.owner_user_id == user_id,
|
||||
places.deleted.is_(False),
|
||||
)
|
||||
)
|
||||
).first()
|
||||
return ErrorType.SUCCESS, row
|
||||
|
||||
_err, row = await DB_SESSION_MNG.execute_lambda(place_posts.DBType(), DBWRType.DB_READ.value, run)
|
||||
if row is None:
|
||||
return None
|
||||
post, name = row
|
||||
expires = post.token_expires_at
|
||||
if expires is not None:
|
||||
# 메일 링크와 같은 만료(그날 자정 KST). DB 값이 tz 없이 오면 UTC 로 본다.
|
||||
if expires.tzinfo is None:
|
||||
expires = expires.replace(tzinfo=timezone.utc)
|
||||
if expires < _now():
|
||||
return None
|
||||
return post, name
|
||||
|
||||
|
||||
async def approval_notice(channel_user_key: str, post_id: str, edit_token: str | None = None) -> dict:
|
||||
"""Event API 로 시작된 승인 알림을 그린다 — 글 문구와 [수정하기] 링크.
|
||||
|
||||
★ 연결된 본인의 글이 아니면 본문을 한 글자도 주지 않는다. 연결 안 된 발화자·남의 글·
|
||||
이미 처리한 글·기한 지난 글은 구분하지 않고 같은 안내로 답한다(구분해 주면 글 ID 를
|
||||
탐색할 수 있다). 예외를 던지지 않는 것은 handle() 과 같은 규약이다."""
|
||||
row = await _link_row(channel_user_key)
|
||||
if row is None:
|
||||
return _say("연결된 계정을 찾지 못했어요. 관리자 화면에서 다시 연결해 주세요.")
|
||||
|
||||
found = await _owned_pending_post(row.user_id, post_id)
|
||||
if found is None:
|
||||
return _say("이미 처리했거나 기한이 지난 글이에요.")
|
||||
|
||||
post, name = found
|
||||
links = []
|
||||
if edit_token:
|
||||
# 메일의 '고쳐서 올리려면' 과 같은 일회용 코드다 — 어느 쪽이든 먼저 누른 쪽이 쓴다.
|
||||
links = [{"label": "수정하기", "url": f"{blog_service.app_origin()}/v1/site/post/edit?t={quote(edit_token, safe='')}"}]
|
||||
# 승인 버튼은 글 ID 만 실어 돌려주고, 그리는 건 채널 몫이다(블록 ID 같은 카카오 값이 여기 없다).
|
||||
return _say(
|
||||
f"[{name}] 이번 글을 올릴까요?\n\n{post.body}",
|
||||
links=links,
|
||||
approve_post_id=str(post.post_id),
|
||||
hint="고쳐서 올리려면 아래 버튼을 눌러 주세요.", # 승인 버튼이 붙으면 채널이 문구를 바꾼다
|
||||
)
|
||||
|
||||
|
||||
async def approve_post(channel_user_key: str, post_id: str) -> dict:
|
||||
"""카톡 [승인] 버튼 — 연결된 본인의 글일 때만 올린다.
|
||||
|
||||
★ 버튼이 들고 온 post_id 를 믿지 않는다. 발화자 키 → 사장님으로 찾은 뒤 그 글이 그
|
||||
사장님 가게의 미처리·기한 전 글인지를 다시 본다(approval_notice 와 같은 관문).
|
||||
틀리면 아무것도 승인하지 않고, 어느 쪽이 틀렸는지 구분하지 않고 같은 안내로 답한다.
|
||||
★ 승인 자체는 메일 링크·빌더 '바로 발행' 과 같은 PostService.approve_by_owner 다 —
|
||||
재발행 잡과 쓰레드 공유까지 세 경로가 똑같이 탄다. 이미 올린 글을 또 누르면 위 관문에서
|
||||
걸려 두 번 올라가지 않는다. 예외를 던지지 않는 것은 handle() 과 같은 규약이다."""
|
||||
row = await _link_row(channel_user_key)
|
||||
if row is None:
|
||||
return _say("연결된 계정을 찾지 못했어요. 관리자 화면에서 다시 연결해 주세요.")
|
||||
|
||||
found = await _owned_pending_post(row.user_id, post_id)
|
||||
if found is None:
|
||||
return _say("이미 처리했거나 기한이 지난 글이에요.")
|
||||
|
||||
user = await _user_info(row.user_id)
|
||||
if user is None:
|
||||
return _say("계정을 찾지 못했어요. 관리자 화면에서 다시 연결해 주세요.")
|
||||
|
||||
post, name = found
|
||||
service = PostService()
|
||||
result = await service.approve_by_owner(user, str(post.place_id), str(post.post_id))
|
||||
if not result.result.success:
|
||||
return _say("지금은 올리지 못했어요. 잠시 뒤 다시 눌러 주세요.")
|
||||
|
||||
# 재발행은 몇 분 걸린다 — 메일 승인 확인 화면과 같이, 어디로 가면 보이는지를 바로 알려준다.
|
||||
url = await service.blog_url(post.place_id)
|
||||
links = [{"label": "사이트 보기", "url": url}] if url else []
|
||||
return _say(
|
||||
f"[{name}] 올렸습니다.\n사이트에 반영되기까지 몇 분 걸려요.",
|
||||
links=links,
|
||||
hint="반영되면 아래 버튼으로 확인해 보세요.",
|
||||
)
|
||||
|
||||
|
||||
_ERRORS = {
|
||||
"PLACE_NOT_FOUND": "그 가게를 찾지 못했어요.",
|
||||
"AGENT_NOT_CONFIGURED": "지금은 대화 기능이 꺼져 있어요.",
|
||||
|
||||
@@ -11,15 +11,17 @@
|
||||
import uuid
|
||||
from datetime import date, datetime, timedelta, timezone
|
||||
|
||||
import httpx
|
||||
from sqlalchemy import select
|
||||
|
||||
from config import social_config
|
||||
from config import agent_config, social_config
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import place_posts, places, sites, users
|
||||
from common.enums import DBWRType, PostStatus, SiteStatus
|
||||
from common.logger import LOG
|
||||
from crud.post_crud import PostCRUD
|
||||
from services import blog_service, mail_service, site_payload
|
||||
from services import blog_service, kakao_link_service, mail_service, site_payload
|
||||
from services.external import kakao_event
|
||||
from services.snapshot import build_snapshot
|
||||
|
||||
BATCH_SIZE = 30
|
||||
@@ -225,29 +227,90 @@ def _app_origin() -> str:
|
||||
return blog_service.app_origin()
|
||||
|
||||
|
||||
def _kakao_push_ready() -> bool:
|
||||
"""카톡 승인 알림을 보낼 수 있는 환경인가. DB 를 안 본다 — 스윕 맨 앞에서 싸게 거른다."""
|
||||
return agent_config.approval_push_enabled() and kakao_event.is_configured()
|
||||
|
||||
|
||||
async def _kakao_target(user) -> str | None:
|
||||
"""이 사장님에게 카톡으로 보낼 수 있으면 발화자 키, 아니면 None(스위치 꺼짐·미연결·끊김)."""
|
||||
if not _kakao_push_ready():
|
||||
return None
|
||||
return await kakao_link_service.linked_key(user.user_id)
|
||||
|
||||
|
||||
def _can_mail(place, user) -> bool:
|
||||
return mail_service.is_configured() and mail_service.is_valid_address(_notify_address(place, user) or "")
|
||||
|
||||
|
||||
async def _push_kakao(channel_user_key: str, post, edit_token: str) -> bool:
|
||||
"""승인 알림을 카톡으로. 실패해도 예외를 올리지 않는다 — 친구가 아니거나 차단했으면
|
||||
실패하는 게 정상 경로라, 호출부가 메일로 대신할 수 있어야 한다.
|
||||
|
||||
★ 글 본문·수정 링크는 여기서 만들지 않는다. 오픈빌더 이벤트 블록의 스킬(우리 웹훅)이
|
||||
params 의 글 ID 로 **연결된 본인 글인지 다시 확인한 뒤** 그린다. 수정 링크용 일회용
|
||||
코드는 평문을 지금밖에 모르므로 params 로 넘긴다(메일과 같은 코드다)."""
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
await kakao_event.send(
|
||||
channel_user_key,
|
||||
agent_config.get("KAKAO_APPROVAL_EVENT_NAME", "post_approval"),
|
||||
params={"post_id": str(post.post_id), "edit_token": edit_token},
|
||||
client=client,
|
||||
)
|
||||
return True
|
||||
except kakao_event.KakaoEventError as ex:
|
||||
LOG.w(f"[blog] post={post.post_id} 카톡 승인 알림 실패: {ex}")
|
||||
except httpx.HTTPError as ex:
|
||||
LOG.w(f"[blog] post={post.post_id} 카톡 승인 알림 실패: {type(ex).__name__}")
|
||||
return False
|
||||
|
||||
|
||||
async def _send_one(place, user, post) -> bool:
|
||||
"""토큰 발급 → 메일 본문 조립 → 발송 → 성공하면 SENT 로 표시. 실패하면 DB 를 안 건드린다."""
|
||||
"""토큰 발급 → 메일·카톡 발송 → 하나라도 나갔으면 SENT 로 표시. 아무 데도 안 나갔으면
|
||||
DB 를 안 건드린다(다시 시도할 길을 막지 않는다).
|
||||
|
||||
★ 카톡과 메일은 **둘 다** 보낸다(2026-09-29 결정). 카톡은 채널 친구가 아니거나 차단했으면
|
||||
실패하므로, 카톡이 붙어도 메일을 빼지 않는다."""
|
||||
token, token_hash, expires = blog_service.issue_token()
|
||||
# ★ 수정 링크도 일회용 코드다. 예전에는 여기 빌더 액세스 토큰을 통짜로 실었고,
|
||||
# 메일 전달 한 번이 자정까지의 권한 양도였다(migrations/0023).
|
||||
edit_token, edit_hash, _edit_expires = blog_service.issue_token()
|
||||
body = _mail_body(
|
||||
place_name=place.name, post=post, user=user,
|
||||
origin=_app_origin(), approve_token=token, edit_token=edit_token,
|
||||
)
|
||||
ok = mail_service.send(to=_notify_address(place, user), subject=f"[{place.name}] 이번 글 올릴까요?", text=body)
|
||||
if not ok:
|
||||
return False
|
||||
await DB_SESSION_MNG.execute_lambda_run(
|
||||
[place_posts.DBType()],
|
||||
[lambda s, pid=post.post_id, h=token_hash, e=expires, eh=edit_hash: _crud.mark_sent(s, pid, h, e, eh)],
|
||||
)
|
||||
return True
|
||||
|
||||
mail_ok = False
|
||||
if _can_mail(place, user):
|
||||
body = _mail_body(
|
||||
place_name=place.name, post=post, user=user,
|
||||
origin=_app_origin(), approve_token=token, edit_token=edit_token,
|
||||
)
|
||||
mail_ok = mail_service.send(to=_notify_address(place, user), subject=f"[{place.name}] 이번 글 올릴까요?", text=body)
|
||||
|
||||
async def mark_sent():
|
||||
await DB_SESSION_MNG.execute_lambda_run(
|
||||
[place_posts.DBType()],
|
||||
[lambda s, pid=post.post_id, h=token_hash, e=expires, eh=edit_hash: _crud.mark_sent(s, pid, h, e, eh)],
|
||||
)
|
||||
|
||||
# ★ 메일이 나갔으면 카톡보다 **먼저** SENT 로 표시한다. 이벤트가 나가자마자 웹훅이 이 글을
|
||||
# 읽는데, 그때 수정 코드 해시가 저장돼 있으면 [수정하기] 가 바로 먹는다. 카톡만 나가는
|
||||
# 경우는 발송이 성공해야 표시할 수 있어 그 뒤에 한다 — 사장님이 버튼을 누르기까지의
|
||||
# 시간이 그 간격보다 훨씬 길다(웹훅은 REVIEWED 글도 읽는다).
|
||||
if mail_ok:
|
||||
await mark_sent()
|
||||
|
||||
kakao_key = await _kakao_target(user)
|
||||
if kakao_key is None:
|
||||
return mail_ok
|
||||
|
||||
kakao_ok = await _push_kakao(kakao_key, post, edit_token)
|
||||
if kakao_ok and not mail_ok:
|
||||
await mark_sent()
|
||||
return mail_ok or kakao_ok
|
||||
|
||||
|
||||
async def send_reviewed() -> int:
|
||||
"""검수를 통과한 글을 사장님에게 한 통씩 보낸다. 보낸 수를 돌려준다."""
|
||||
if not mail_service.is_configured():
|
||||
if not mail_service.is_configured() and not _kakao_push_ready():
|
||||
return 0
|
||||
|
||||
_err, rows = await DB_SESSION_MNG.execute_lambda(
|
||||
@@ -264,7 +327,8 @@ async def send_reviewed() -> int:
|
||||
if not target:
|
||||
continue
|
||||
place, user = target
|
||||
if not mail_service.is_valid_address(_notify_address(place, user) or ""):
|
||||
# 메일도 카톡도 보낼 수 없는 사장님은 건너뛴다. 하나라도 되면 _send_one 이 갈래를 정한다.
|
||||
if not _can_mail(place, user) and await _kakao_target(user) is None:
|
||||
continue
|
||||
if await _send_one(place, user, post):
|
||||
sent += 1
|
||||
@@ -275,7 +339,7 @@ async def send_now_for_place(place_id: str) -> dict:
|
||||
"""사장님이 빌더 화면에서 누르는 즉시 발송 — 아침 9시 스윕을 기다리지 않고 이 업장의
|
||||
오늘 몫을 지금 보낸다(2026-09-21, 사장님 요청: "지금 바로 발송할 수 있도록").
|
||||
'하루 한 통' 원칙은 그대로다 — 이미 오늘 보냈으면(REVIEWED 가 아니면) 보낼 게 없다."""
|
||||
if not mail_service.is_configured():
|
||||
if not mail_service.is_configured() and not _kakao_push_ready():
|
||||
return {"sent": False, "reason": "MAIL_NOT_CONFIGURED"}
|
||||
|
||||
place = user = None
|
||||
@@ -293,7 +357,7 @@ async def send_now_for_place(place_id: str) -> dict:
|
||||
if post is None:
|
||||
return {"sent": False, "reason": "NOTHING_DUE"}
|
||||
|
||||
if not mail_service.is_valid_address(_notify_address(place, user) or ""):
|
||||
if not _can_mail(place, user) and await _kakao_target(user) is None:
|
||||
return {"sent": False, "reason": "NO_VALID_EMAIL"}
|
||||
|
||||
if not await _send_one(place, user, post):
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
"""카카오 챗봇 Event API — 연결된 사장님에게 챗봇이 **먼저** 말을 거는 유일한 통로.
|
||||
|
||||
카카오 계약(주소·인증 헤더·요청 모양)은 여기 한 곳에만 둔다. 알림톡 어댑터(alimtalk.py)와
|
||||
같은 규칙이다 — 서비스 계층에 카카오 모양이 새면 채널을 바꿀 때 전부 걷어내야 한다.
|
||||
|
||||
★ 사용자 식별값은 `botUserKey` 다. 오픈빌더 웹훅의 `userRequest.user.id` 와 같은 값이라
|
||||
`owner_kakao_links.channel_user_key` 를 그대로 쓴다. 사용자가 채널에 **처음 말을 건 뒤에야**
|
||||
채번되므로, 연결 코드를 보낸 사장님만 받을 수 있다(카카오 데브톡 답변).
|
||||
★ 채널을 친구 추가하지 않았거나 차단했으면 전송은 실패한다 — 호출부가 다른 경로(메일)로
|
||||
대체할 수 있도록 실패는 예외로 올린다.
|
||||
★ 예외 문구에 REST 키·발화자 ID·응답 원문을 넣지 않는다. 이 문자열은 로그로 간다.
|
||||
진단용 원문은 `KakaoEventError.detail` 에만 담는다.
|
||||
"""
|
||||
|
||||
import httpx
|
||||
|
||||
from config import agent_config as config
|
||||
|
||||
BASE_URL = "https://bot-api.kakao.com/v2/bots"
|
||||
|
||||
|
||||
class KakaoEventError(RuntimeError):
|
||||
"""Event API 호출 실패. `str()` 은 로그에 나가도 되는 코드뿐이고, 원문은 `detail`."""
|
||||
|
||||
def __init__(self, code: str, detail: str = ""):
|
||||
super().__init__(code)
|
||||
self.detail = detail
|
||||
|
||||
|
||||
def is_configured() -> bool:
|
||||
return bool(config.get("KAKAO_BOT_ID") and config.get("KAKAO_BOT_REST_API_KEY"))
|
||||
|
||||
|
||||
def _url() -> str:
|
||||
bot_id = config.get("KAKAO_BOT_ID")
|
||||
if config.get("KAKAO_EVENT_DEV", "0") == "1":
|
||||
bot_id += "!"
|
||||
return f"{BASE_URL}/{bot_id}/talk"
|
||||
|
||||
|
||||
async def send(bot_user_key: str, event_name: str, *, data: dict | None = None,
|
||||
params: dict | None = None, client: httpx.AsyncClient) -> str:
|
||||
"""이벤트 블록을 호출해 그 사용자에게 메시지를 보낸다. 성공하면 taskId.
|
||||
|
||||
`data` 는 말풍선 안에서 `{{#current.event.data.<이름>}}` 으로, `params` 는 스킬 서버에
|
||||
`userRequest.params` 로 전달된다."""
|
||||
if not is_configured():
|
||||
raise KakaoEventError("KAKAO_EVENT_NOT_CONFIGURED")
|
||||
|
||||
event: dict = {"name": event_name}
|
||||
if data:
|
||||
event["data"] = data
|
||||
body: dict = {"event": event, "user": [{"type": "botUserKey", "id": bot_user_key}]}
|
||||
if params:
|
||||
body["params"] = params
|
||||
|
||||
res = await client.post(
|
||||
_url(),
|
||||
headers={"Authorization": f"KakaoAK {config.get('KAKAO_BOT_REST_API_KEY')}"},
|
||||
json=body,
|
||||
)
|
||||
if res.status_code != 200:
|
||||
raise KakaoEventError(f"KAKAO_EVENT_HTTP_{res.status_code}", res.text[:300])
|
||||
try:
|
||||
payload = res.json()
|
||||
except ValueError as ex:
|
||||
raise KakaoEventError("KAKAO_EVENT_INVALID_RESPONSE", res.text[:300]) from ex
|
||||
if payload.get("status") != "SUCCESS":
|
||||
raise KakaoEventError("KAKAO_EVENT_REJECTED", res.text[:300])
|
||||
return str(payload.get("taskId") or "")
|
||||
@@ -179,6 +179,28 @@ async def resolve(channel_user_key: str) -> UUID | None:
|
||||
return await DB_SESSION_MNG.execute_lambda_write(Link.DBType(), run)
|
||||
|
||||
|
||||
async def linked_key(user_id) -> str | None:
|
||||
"""사장님에게 연결된 카톡 발화자 키(botUserKey). 연결이 없거나 끊겼으면 None.
|
||||
|
||||
★ 승인 알림을 **먼저 보낼** 때 쓴다(Event API). resolve() 와 방향이 반대다 —
|
||||
그건 들어온 발화자로 사장님을 찾는다. 여기서는 사장님으로 발화자를 찾는다."""
|
||||
|
||||
async def run(s):
|
||||
row = (
|
||||
await s.execute(
|
||||
select(Link).where(
|
||||
Link.user_id == user_id,
|
||||
Link.deleted.is_(False),
|
||||
Link.status == KakaoLinkStatus.LINKED.value,
|
||||
Link.channel_user_key.is_not(None),
|
||||
)
|
||||
)
|
||||
).scalars().first()
|
||||
return row.channel_user_key if row is not None else None
|
||||
|
||||
return await DB_SESSION_MNG.execute_lambda_write(Link.DBType(), run)
|
||||
|
||||
|
||||
async def disconnect(user_id: UUID) -> None:
|
||||
"""연결을 끊는다. 행은 REVOKED 로 남긴다 — 지우면 누가 언제 연결했는지가 사라진다.
|
||||
|
||||
|
||||
@@ -135,10 +135,10 @@ class PostService:
|
||||
return {
|
||||
"success": True,
|
||||
"message": APPROVED,
|
||||
"redirect_url": await self._blog_url(place_id),
|
||||
"redirect_url": await self.blog_url(place_id),
|
||||
}
|
||||
|
||||
async def _blog_url(self, place_id) -> str | None:
|
||||
async def blog_url(self, place_id) -> str | None:
|
||||
"""이 업장의 발행된 사이트에서 미니 블로그가 보이는 자리. 승인 확인 화면이 몇 초
|
||||
뒤 여기로 자동 연결한다(2026-09-22, 사장님 지시) — 사장님이 승인만 하고 실제로
|
||||
어디에 올라갔는지 못 찾는 걸 줄인다. 사이트가 없거나 아직 미발행이면 None —
|
||||
|
||||
Reference in new issue
Block a user