More routes
This commit is contained in:
parent
a580b7bccf
commit
a9a10a6d52
12 changed files with 2400 additions and 211 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue