Expose new analytics data in backend route (#5982)

* Expose more analytics data in backend

* Adjust fetch analytics body

* fix

* fix
This commit is contained in:
aecsocket
2026-05-04 17:33:26 +01:00
committed by GitHub
parent e13a89dd72
commit 2f311643a0
2 changed files with 129 additions and 55 deletions

View File

@@ -33,7 +33,16 @@ pub struct Download {
/// Why a project was downloaded.
#[derive(
Debug, Display, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize,
Debug,
Display,
Clone,
Copy,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize,
utoipa::ToSchema,
)]
#[serde(rename_all = "snake_case")]
#[display(rename_all = "snake_case")]
@@ -47,6 +56,15 @@ pub enum DownloadReason {
Modpack,
}
impl std::str::FromStr for DownloadReason {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_value(serde_json::Value::String(s.to_string()))
.map_err(|_| ())
}
}
#[derive(Debug, Row, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)]
pub struct PageView {
pub recorded: i64,