Skip to main content

systemprompt_analytics/repository/core_stats/
mod.rs

1//! Core platform statistics aggregated from analytics tables.
2//!
3//! [`CoreStatsRepository`] backs the dashboard overview, activity trends,
4//! categorical breakdowns, and leaderboards, with the read queries split
5//! across the sibling submodules.
6
7mod activity;
8mod breakdowns;
9mod leaderboards;
10mod overview;
11
12use crate::Result;
13use sqlx::PgPool;
14use std::sync::Arc;
15use systemprompt_database::DbPool;
16
17#[derive(Debug)]
18pub struct CoreStatsRepository {
19    pool: Arc<PgPool>,
20}
21
22impl CoreStatsRepository {
23    pub fn new(db: &DbPool) -> Result<Self> {
24        let pool = db.pool_arc()?;
25        Ok(Self { pool })
26    }
27}