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
@@ -35,6 +35,7 @@ pub fn build_router(state: AppState) -> Router {
|
||||
.route("/cards/handle/:handle", get(cards::get_card_by_handle))
|
||||
.route("/cards/:id/analytics", get(analytics::summary))
|
||||
.route("/cards/:id/analytics/feed", get(analytics::feed))
|
||||
.route("/cards/:id/analytics/geo", get(analytics::geo))
|
||||
.route("/cards/:id/share", post(share::create_share))
|
||||
.route("/cards/:id/share-links", get(share::list_shares))
|
||||
.route("/s/:token", get(share::resolve_share))
|
||||
|
||||
Reference in New Issue
Block a user