운영 지표와 지원 요청 저장소 추가

This commit is contained in:
Yun Chan 2026-06-28 20:13:06 +09:00
parent 50fa4ad432
commit e7ebb38177
20 changed files with 3038 additions and 39 deletions

View file

@ -0,0 +1,31 @@
"""Support-ticket helpers shared across user and admin routes."""
from __future__ import annotations
import hashlib
import json
import re
_SPACE_RE = re.compile(r"\s+")
def _normalize_fingerprint_part(value: str | None) -> str:
return _SPACE_RE.sub(" ", (value or "").strip().lower())
def support_ticket_fingerprint(
*,
category: str,
subject: str,
body: str,
source_path: str,
) -> str:
"""Return a stable hash for exact-ish duplicate support-ticket hints."""
payload = {
"body": _normalize_fingerprint_part(body),
"category": _normalize_fingerprint_part(category),
"source_path": _normalize_fingerprint_part(source_path),
"subject": _normalize_fingerprint_part(subject),
}
encoded = json.dumps(payload, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")
return hashlib.sha256(encoded).hexdigest()