[feat] solution/backend,frontend,postgres-init: 서비스 사이트 공개 화면 방문 수집 — 전체 방문 통계에 합산하고 사이트 표에 한 줄로, 기능 문서 추가
This commit is contained in:
1 parent
2fc50de161
commit
99a344f65c
21 files changed
+378
-21
No files matched your search
@@ -95,3 +95,22 @@ async def test_개발자가_아니면_403(client, auth_headers):
|
||||
owner = await auth_headers("owner6", role=UserRole.OWNER.value)
|
||||
assert (await client.get("/v1/ops/stats/visits", headers=owner)).status_code == 403
|
||||
assert (await client.get(f"/v1/ops/sites/{uuid.uuid4()}/stats/visits", headers=owner)).status_code == 403
|
||||
|
||||
|
||||
async def test_전체_통계는_서비스_사이트를_합치고_한_줄로_보여_준다(client, auth_headers, db_engine):
|
||||
dev = await auth_headers("dev7", role=UserRole.DEVELOPER.value)
|
||||
pid, sid = await _site(client, auth_headers, db_engine, "발행가게")
|
||||
at = datetime(2026, 10, 7, 3, 0, tzinfo=timezone.utc)
|
||||
await _view(db_engine, at, sid, visitor="a", path="/s/x")
|
||||
await _view(db_engine, at, None, visitor="b", path="/", ref="google.com", utm="insta")
|
||||
await _view(db_engine, at, None, visitor="b", path="/pricing")
|
||||
await _view(db_engine, at, None, visitor="c", path="/")
|
||||
params = {"from": "2026-10-07", "to": "2026-10-07"}
|
||||
|
||||
# 전체 — 발행 사이트와 서비스 사이트를 합친다. 사이트 표에는 서비스 사이트가 한 줄(place_id 없음)로 낀다.
|
||||
overall = (await client.get("/v1/ops/stats/visits", headers=dev, params=params)).json()
|
||||
assert (overall["summary"]["views"], overall["summary"]["visitors"], overall["summary"]["direct_views"]) == (4, 3, 3)
|
||||
assert [(r.get("place_id"), r["name"], r["views"], r["visitors"], r.get("service", False)) for r in overall["sites"]] == [
|
||||
(None, "서비스 사이트", 3, 2, True),
|
||||
(pid, "발행가게", 1, 1, False),
|
||||
]
|
||||
Reference in new issue
Block a user