From f8172d7e61e3a5f87270e5acb32eb3c9e3cc0229 Mon Sep 17 00:00:00 2001 From: blek Date: Sun, 22 Oct 2023 15:16:13 +1000 Subject: [PATCH] move out the files api to a different folder --- filed/src/web/api.rs | 4 ++-- filed/src/web/api/files.rs | 1 + filed/src/web/api/{ => files}/get_all.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 filed/src/web/api/files.rs rename filed/src/web/api/{ => files}/get_all.rs (88%) diff --git a/filed/src/web/api.rs b/filed/src/web/api.rs index 3b3c255..d07602b 100644 --- a/filed/src/web/api.rs +++ b/filed/src/web/api.rs @@ -1,11 +1,11 @@ use warp::{reply::Reply, reject::Rejection, Filter}; use serde::{Serialize, Deserialize}; -use self::get_all::get_all_f; +use self::files::get_all::get_all_f; use super::state::SharedState; -mod get_all; +mod files; mod types; #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/filed/src/web/api/files.rs b/filed/src/web/api/files.rs new file mode 100644 index 0000000..2cc462a --- /dev/null +++ b/filed/src/web/api/files.rs @@ -0,0 +1 @@ +pub mod get_all; \ No newline at end of file diff --git a/filed/src/web/api/get_all.rs b/filed/src/web/api/files/get_all.rs similarity index 88% rename from filed/src/web/api/get_all.rs rename to filed/src/web/api/files/get_all.rs index 6b4286c..e4d5b08 100644 --- a/filed/src/web/api/get_all.rs +++ b/filed/src/web/api/files/get_all.rs @@ -2,14 +2,14 @@ use warp::{reply::{Reply, json}, reject::Rejection, Filter, http::StatusCode}; use crate::web::{state::SharedState, rejection::HttpReject}; -use super::types::ErrorMessage; +use super::super::types::{ErrorMessage, Error}; pub async fn get_all(state: SharedState) -> Result, Rejection> { if ! state.config.api.enabled { return Ok( Box::new( warp::reply::with_status( - json(&ErrorMessage::new(super::types::Error::APIDisabled)), + json(&ErrorMessage::new(Error::APIDisabled)), StatusCode::SERVICE_UNAVAILABLE ) )