consistent case
This commit is contained in:
parent
03af6f4dc5
commit
78df4177a6
@ -5,11 +5,12 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
|
||||
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "log_level")]
|
||||
#[strum(serialize_all = "lowercase")]
|
||||
pub enum LogLevel {
|
||||
#[sea_orm(string_value = "none")]
|
||||
None,
|
||||
#[sea_orm(string_value = "aggregate")]
|
||||
Aggregate,
|
||||
#[sea_orm(string_value = "aggregated")]
|
||||
Aggregated,
|
||||
#[sea_orm(string_value = "detailed")]
|
||||
Detailed,
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ impl ProxyResponseStat {
|
||||
// keep the method since the rpc key is not attached
|
||||
Some(self.method.clone())
|
||||
}
|
||||
LogLevel::Aggregate => {
|
||||
LogLevel::Aggregated => {
|
||||
// Lose the method
|
||||
None
|
||||
}
|
||||
|
@ -71,7 +71,11 @@ pub async fn serve(port: u16, proxy_app: Arc<Web3ProxyApp>) -> anyhow::Result<()
|
||||
.route("/user/revert_logs", get(users::user_revert_logs_get))
|
||||
.route(
|
||||
"/user/stats/aggregate",
|
||||
get(users::user_stats_aggregate_get),
|
||||
get(users::user_stats_aggregated_get),
|
||||
)
|
||||
.route(
|
||||
"/user/stats/aggregated",
|
||||
get(users::user_stats_aggregated_get),
|
||||
)
|
||||
.route("/user/stats/detailed", get(users::user_stats_detailed_get))
|
||||
.route("/user/logout", post(users::user_logout_post))
|
||||
|
@ -547,10 +547,14 @@ pub async fn rpc_keys_management(
|
||||
// TODO: limit to 10 keys?
|
||||
let secret_key = RpcSecretKey::new();
|
||||
|
||||
let log_level = payload
|
||||
.log_level
|
||||
.context("log level must be 'none', 'detailed', or 'aggregated'")?;
|
||||
|
||||
rpc_key::ActiveModel {
|
||||
user_id: sea_orm::Set(user.id),
|
||||
secret_key: sea_orm::Set(secret_key.into()),
|
||||
log_level: sea_orm::Set(payload.log_level.unwrap_or(LogLevel::None)),
|
||||
log_level: sea_orm::Set(log_level),
|
||||
..Default::default()
|
||||
}
|
||||
};
|
||||
@ -743,12 +747,12 @@ pub async fn user_revert_logs_get(
|
||||
/// `GET /user/stats/aggregate` -- Public endpoint for aggregate stats such as bandwidth used and methods requested.
|
||||
#[debug_handler]
|
||||
|
||||
pub async fn user_stats_aggregate_get(
|
||||
pub async fn user_stats_aggregated_get(
|
||||
Extension(app): Extension<Arc<Web3ProxyApp>>,
|
||||
bearer: Option<TypedHeader<Authorization<Bearer>>>,
|
||||
Query(params): Query<HashMap<String, String>>,
|
||||
) -> FrontendResult {
|
||||
let response = query_user_stats(&app, bearer, ¶ms, StatResponse::Aggregate).await?;
|
||||
let response = query_user_stats(&app, bearer, ¶ms, StatResponse::Aggregated).await?;
|
||||
|
||||
Ok(Json(response).into_response())
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ pub fn filter_query_window_seconds(
|
||||
}
|
||||
|
||||
pub enum StatResponse {
|
||||
Aggregate,
|
||||
Aggregated,
|
||||
Detailed,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user