feat(views): anonymous daily view counter with social-proof badge

- New table symbol_views_daily(code, view_date, views) via migration 004.
- POST /api/views/{code} UPSERTs and returns today_views; GET returns
  today + last_7d + trend (last 7 days).
- Client dedupes via localStorage (views:logged map keyed by KST date) so a
  given browser counts once per day per code; refresh/extra tabs don't inflate.
- PriceHero shows "오늘 N명이 봤어요" pill when viewsToday > 0.

Read-only social proof — Toss 의 종목 상세에서 익명 카운트로 진입 신호를 주는 패턴.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-owner
2026-05-28 23:56:36 +09:00
parent ef127ae2e8
commit ecf8b9112b
7 changed files with 248 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ from app.api.predict import router as predict_router
from app.api.refresh import router as refresh_router
from app.api.symbols import router as symbols_router
from app.api.themes import router as themes_router
from app.api.views import router as views_router
from app.config import settings
from app.db.connection import get_engine, ping as db_ping
from app.fetch import dart as dart_mod
@@ -110,6 +111,7 @@ app.include_router(markets_router)
app.include_router(themes_router)
app.include_router(orderbook_router)
app.include_router(fundamentals_router)
app.include_router(views_router)
def _resolved_device() -> str: