Phase 2: analytics rollups, geo breakdown, event feed (backend)
- Idempotent hourly rollup (run_rollup, INSERT ... ON CONFLICT DO UPDATE into
analytics_rollups_hourly) + Tokio background task (startup then hourly)
- GET /v1/cards/{id}/analytics/geo — country-grouped visit counts
- GeoResolver trait: real MaxMind under the `geoip` feature, no-op default;
raw IP resolved then discarded (only hash + coarse country/city persisted)
- analytics_events now store country/city; rollups read query for the dashboard
2 new tests (geo grouping, rollup aggregation + idempotency); 75 backend tests.
fmt + clippy clean; geoip feature compiles.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e66813ef58
commit
4770efd861
@@ -14,6 +14,7 @@ workspace = true
|
||||
# structurally-correct but unsigned passes — logged loudly at startup.
|
||||
default = []
|
||||
apple-signing = ["cardclaws-wallet/apple-signing"]
|
||||
geoip = ["dep:maxminddb"]
|
||||
|
||||
[[bin]]
|
||||
name = "cardclaws-api"
|
||||
@@ -43,6 +44,7 @@ rand = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
validator = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
maxminddb = { version = "0.24", optional = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
@@ -51,6 +53,7 @@ thiserror = { workspace = true }
|
||||
cardclaws-auth = { workspace = true }
|
||||
cardclaws-wallet = { workspace = true }
|
||||
cardclaws-config = { workspace = true }
|
||||
cardclaws-db = { workspace = true }
|
||||
tower = { workspace = true, features = ["util"] }
|
||||
http-body-util = "0.1"
|
||||
tokio = { workspace = true }
|
||||
|
||||
Reference in New Issue
Block a user