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 slug: Option<String>,
10 pub title: Option<String>,
11 pub source_id: Option<String>,
12 pub total_views: i64,
13 pub unique_visitors: i64,
14 pub avg_time_on_page_seconds: Option<f64>,
15 pub trend_direction: Option<String>,
16}
17
18#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
19pub struct ContentStatsRow {
20 pub total_views: i64,
21 pub unique_visitors: i64,
22 pub avg_time_on_page_seconds: Option<f64>,
23 pub avg_scroll_depth: Option<f64>,
24 pub total_clicks: i64,
25}
26
27#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
28pub struct ContentTrendRow {
29 pub timestamp: DateTime<Utc>,
30 pub views: i64,
31 pub unique_visitors: i64,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
35pub struct TrafficSourceRow {
36 pub source: Option<String>,
37 pub count: i64,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
41pub struct GeoRow {
42 pub country: Option<String>,
43 pub count: i64,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
47pub struct DeviceRow {
48 pub device: Option<String>,
49 pub browser: Option<String>,
50 pub count: i64,
51}
52
53#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
54pub struct BotTotalsRow {
55 pub human: i64,
56 pub bot: i64,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
60pub struct BotTypeRow {
61 pub bot_type: Option<String>,
62 pub count: i64,
63}