aboutsummaryrefslogtreecommitdiff
path: root/common/src/api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/api.rs')
-rw-r--r--common/src/api.rs31
1 files changed, 30 insertions, 1 deletions
diff --git a/common/src/api.rs b/common/src/api.rs
index aaff940..c4751a3 100644
--- a/common/src/api.rs
+++ b/common/src/api.rs
@@ -3,7 +3,12 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
-use crate::{url_enum, user::NodeUserData, Node, NodeKind};
+use crate::{
+ url_enum,
+ user::{NodeUserData, User},
+ Node, NodeKind,
+};
+use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, sync::Arc, time::Duration};
@@ -43,6 +48,30 @@ pub struct ApiStatsResponse {
pub total: StatsBin,
}
+#[derive(Serialize, Deserialize)]
+pub struct ApiAdminUsersResponse {
+ pub users: Vec<User>,
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct LogLine {
+ pub time: DateTime<Utc>,
+ pub module: Option<&'static str>,
+ pub level: LogLevel,
+ pub message: String,
+}
+
+url_enum!(
+ #[derive(Serialize, Deserialize, Clone, Copy, PartialEq)]
+ enum LogLevel {
+ Trace = "trace",
+ Debug = "debug",
+ Info = "info",
+ Warn = "warn",
+ Error = "error",
+ }
+);
+
#[derive(Default, Serialize, Deserialize)]
pub struct StatsBin {
pub runtime: f64,