[feat] solution: SNS 연동 확인용 테스트 게시 기능 추가

This commit is contained in:
skkim committed 2026-09-18 13:00:03 +09:00
1 parent d77f2aa14c
commit 921c85df25
4 files changed
+114

No files matched your search

@@ -149,6 +149,26 @@ def posting_enabled():
return accounts.configured() and config.get("SOCIAL_POSTING_ENABLED") == "1"
async def test_post(user_id, text, provider=2):
"""사장님이 자기 계정 연결이 실제로 되는지 확인하려고 한 줄 올려 보는 것.
★ 왜 posting_enabled()·승인 절차를 거치지 않는가 — 그 게이트는 승인 기반
"소식 발행" 상품을 계약·해지 안내 정책이 끝나기 전에 열지 않으려는 것이다.
여기서 사장님이 자기 계정에 테스트 한 줄을 올리는 것은 그 상품과 무관하다.
"""
async def run(s):
await accounts.lock_user(s, user_id, provider)
row = await accounts.account(s, user_id, provider)
if not row:
raise SocialError("ACCOUNT_CONNECTION_REQUIRED")
async with httpx.AsyncClient(timeout=20) as client:
token = await accounts.get_usable_token(s, row, client)
return await adapter(provider).publish(text, token, client=client)
return await db.transaction(run)
async def create_draft(user_id, place_id, provider=2):
async def run(s):
place, site, url = await target(s, user_id, place_id)