Fix how analytics writes are serialized (#5926)

This commit is contained in:
aecsocket
2026-04-27 13:25:57 +01:00
committed by GitHub
parent 548357c92c
commit e8be67d41f
7 changed files with 74 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
use clickhouse::Row;
use derive_more::Display;
use serde::{Deserialize, Serialize};
use std::hash::Hash;
use std::net::Ipv6Addr;
@@ -24,14 +25,18 @@ pub struct Download {
pub user_agent: String,
pub headers: Vec<(String, String)>,
// added retroactively - may be missing
pub reason: Option<DownloadReason>,
pub game_version: Option<String>,
pub loader: Option<String>,
// added retroactively - may be empty
pub reason: String,
pub game_version: String,
pub loader: String,
}
/// Why a project was downloaded.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(
Debug, Display, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize,
)]
#[serde(rename_all = "snake_case")]
#[display(rename_all = "snake_case")]
pub enum DownloadReason {
/// Project was downloaded directly by the user.
Standalone,
@@ -95,8 +100,8 @@ pub struct Playtime {
/// Parent modpack this playtime was recorded in
pub parent: u64,
// added retroactively - may be missing
pub country: Option<String>,
// added retroactively - may be empty
pub country: String,
}
#[derive(Row, Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash)]