systemprompt_analytics/models/cli/
content.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use sqlx::FromRow;
4use systemprompt_identifiers::ContentId;
5
6#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
7pub struct TopContentRow {
8 pub content_id: ContentId,
9 pub total_views: i64,
10 pub unique_visitors: i64,
11 pub avg_time_on_page_seconds: Option<f64>,
12 pub trend_direction: Option<String>,
13}
14
15#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
16pub struct ContentStatsRow {
17 pub total_views: i64,
18 pub unique_visitors: i64,
19 pub avg_time_on_page_seconds: Option<f64>,
20 pub avg_scroll_depth: Option<f64>,
21 pub total_clicks: i64,
22}
23
24#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
25pub struct ContentTrendRow {
26 pub timestamp: DateTime<Utc>,
27 pub views: i64,
28 pub unique_visitors: i64,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
32pub struct TrafficSourceRow {
33 pub source: Option<String>,
34 pub count: i64,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
38pub struct GeoRow {
39 pub country: Option<String>,
40 pub count: i64,
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
44pub struct DeviceRow {
45 pub device: Option<String>,
46 pub browser: Option<String>,
47 pub count: i64,
48}
49
50#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
51pub struct BotTotalsRow {
52 pub human: i64,
53 pub bot: i64,
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
57pub struct BotTypeRow {
58 pub bot_type: Option<String>,
59 pub count: i64,
60}