systemprompt_analytics/models/cli/
content.rs1use chrono::{DateTime, Utc};
7use serde::{Deserialize, Serialize};
8use sqlx::FromRow;
9use systemprompt_identifiers::{ContentId, SourceId};
10
11#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
12pub struct TopContentRow {
13 pub content_id: ContentId,
14 pub slug: Option<String>,
15 pub title: Option<String>,
16 pub source_id: Option<SourceId>,
17 pub total_views: i64,
18 pub unique_visitors: i64,
19 pub avg_time_on_page_seconds: Option<f64>,
20 pub trend_direction: Option<String>,
21}
22
23#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
24pub struct ContentStatsRow {
25 pub total_views: i64,
26 pub unique_visitors: i64,
27 pub avg_time_on_page_seconds: Option<f64>,
28 pub avg_scroll_depth: Option<f64>,
29 pub total_clicks: i64,
30}
31
32#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
33pub struct ContentTrendRow {
34 pub timestamp: DateTime<Utc>,
35 pub views: i64,
36 pub unique_visitors: i64,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
40pub struct TrafficSourceRow {
41 pub source: Option<String>,
42 pub count: i64,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
46pub struct TrafficPageRow {
47 pub page: Option<String>,
48 pub source: Option<String>,
49 pub count: i64,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
53pub struct TrafficNavigationRow {
54 pub from_path: Option<String>,
55 pub to_path: Option<String>,
56 pub count: i64,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
60pub struct GeoRow {
61 pub country: Option<String>,
62 pub count: i64,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
66pub struct DeviceRow {
67 pub device: Option<String>,
68 pub browser: Option<String>,
69 pub count: i64,
70}
71
72#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
73pub struct BotTotalsRow {
74 pub human: i64,
75 pub ghost: i64,
76 pub bot: i64,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
80pub struct BotTypeRow {
81 pub bot_type: Option<String>,
82 pub count: i64,
83}