Add basic analytics

This commit is contained in:
Gregory Schier
2023-11-07 09:53:59 -08:00
parent 0f6e4b641a
commit a793ece1a5
21 changed files with 133 additions and 78 deletions

View File

@@ -74,7 +74,7 @@ async fn send_ephemeral_request(
db_instance: State<'_, Mutex<Pool<Sqlite>>>,
) -> Result<models::HttpResponse, String> {
let pool = &*db_instance.lock().await;
let response = models::HttpResponse::default();
let response = models::HttpResponse::new();
let environment_id2 = environment_id.unwrap_or("n/a").to_string();
request.id = "".to_string();
return actually_send_request(request, &response, &environment_id2, &app_handle, pool).await;

View File

@@ -118,6 +118,15 @@ pub struct HttpResponse {
pub headers: Json<Vec<HttpResponseHeader>>,
}
impl HttpResponse {
pub(crate) fn new() -> Self {
Self {
model: "http_response".to_string(),
..Default::default()
}
}
}
#[derive(sqlx::FromRow, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(default, rename_all = "camelCase")]
pub struct KeyValue {