8c805fdd9c
- 새 모듈 app/modules/outreach(권한키 outreach, outreach_db — scripts/sql/outreach_db_init.sql, OUTREACH_DB_URL)
- 리스트 붙여넣기(주소, 이름) → 주소를 보고 메일/DM 판별(store.detect: 이메일·@계정·instagram.com·ig.me·계정명) → 미리보기 → 추가
- 메일 = 고른 줄을 한 UPDATE 로 발송중(두 번 눌러도 한 번) → 백그라운드로 본인 Gmail 한 사람에 한 통(입출고·휴가와 같은 Gmail 연결),
설정 사진 본문 아래(cid), 보냄/실패·기록. 인스타 = 이름 넣은 문구 복사 + ig.me DM 창 → [보냄] 기록(공식 API 는 첫 DM 불가)
- 설정: 제목·본문 기본 = 미라네주방 공동구매 제안 문구, {이름}·**굵게**, 보내는 이름·끝 문구·(광고) 표시, 사진 10장
- 입출고 Gmail 콜백을 모듈 공용으로(_GMAIL_ORIGINS — vacation·outreach)
- 테스트: 판별·본문·발송(가짜 Gmail)·실제 앱·실제 PG(동시 claim 4번 = 1번)·브라우저
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
2.2 KiB
Python
45 lines
2.2 KiB
Python
"""안내문 발송 화면(index.html)을 진짜 ERP 셸로 렌더 — 브라우저 테스트용(2026-10-27).
|
|
|
|
python tests/js/render_outreach.py # → tests/js/.out/outreach.html
|
|
|
|
화면 데이터는 실제 router._view 로 만든다(저장소 없이 줄만 가짜).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
import jinja2
|
|
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
sys.path.insert(0, ROOT)
|
|
OUT_DIR = os.path.join(ROOT, "tests", "js", ".out")
|
|
|
|
from app.modules.outreach import store # noqa: E402
|
|
from app.modules.outreach.router import _view # noqa: E402
|
|
|
|
|
|
def main() -> None:
|
|
os.makedirs(OUT_DIR, exist_ok=True)
|
|
env = jinja2.Environment(loader=jinja2.FileSystemLoader([
|
|
os.path.join(ROOT, "app", "templates"), os.path.join(ROOT, "app", "modules", "outreach", "templates")]), autoescape=True)
|
|
t = {**store.normalize_template(None), "updated_by": "", "updated_at": "", "is_default": True}
|
|
base = {"id": 0, "memo": "", "status": "대기", "sent_at": "", "sent_by": "", "sent_via": "", "last_error": ""}
|
|
raw = [
|
|
{**base, "id": 1, "kind": "email", "handle": "kim@miras.co.kr", "address": "kim@miras.co.kr", "name": "김철수"},
|
|
{**base, "id": 2, "kind": "instagram", "handle": "mira.kitchen", "address": "@mira.kitchen", "name": "미라"},
|
|
{**base, "id": 3, "kind": "email", "handle": "noname@miras.co.kr", "address": "noname@miras.co.kr", "name": ""},
|
|
{**base, "id": 4, "kind": "email", "handle": "done@miras.co.kr", "address": "done@miras.co.kr", "name": "보냄씨",
|
|
"status": "보냄", "sent_at": "2026-10-27T10:00:00+09:00", "sent_via": "gmail"},
|
|
]
|
|
ctx = {"user": {"email": "me@miras.co.kr", "name": "나", "picture": ""}, "is_admin": False, "nav_items": [],
|
|
"page_title": "안내문 발송", "page_subtitle": "", "template": t, "images": [], "rows": [_view(r, t) for r in raw],
|
|
"logs": [], "gmail": {"available": True, "connected": True, "email": "me@miras.co.kr"}, "msg": ""}
|
|
with open(os.path.join(OUT_DIR, "outreach.html"), "w", encoding="utf-8") as f:
|
|
f.write(env.get_template("outreach/index.html").render(**ctx))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|