More routes

This commit is contained in:
Jack Mechem 2026-03-27 17:47:48 -07:00
parent a580b7bccf
commit a9a10a6d52
12 changed files with 2400 additions and 211 deletions

View file

@ -1,6 +1,41 @@
use axum::http::StatusCode;
use axum::response::Json;
use serde::Serialize;
use std::collections::HashMap;
#[derive(Serialize)]
pub struct ActionResponse {
pub success: bool,
pub message: String,
pub stdout: String,
pub stderr: String,
}
impl ActionResponse {
pub fn ok(message: String) -> (StatusCode, Json<Self>) {
(
StatusCode::OK,
Json(Self {
success: true,
message,
stdout: String::new(),
stderr: String::new(),
}),
)
}
pub fn err(status: StatusCode, message: &str) -> (StatusCode, Json<Self>) {
(
status,
Json(Self {
success: false,
message: message.to_string(),
stdout: String::new(),
stderr: String::new(),
}),
)
}
}
#[derive(Serialize)]
pub struct SystemStats {
pub timestamp: String,