move out the files api to a different folder
This commit is contained in:
parent
5d05f7190a
commit
f8172d7e61
|
@ -1,11 +1,11 @@
|
||||||
use warp::{reply::Reply, reject::Rejection, Filter};
|
use warp::{reply::Reply, reject::Rejection, Filter};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
use self::get_all::get_all_f;
|
use self::files::get_all::get_all_f;
|
||||||
|
|
||||||
use super::state::SharedState;
|
use super::state::SharedState;
|
||||||
|
|
||||||
mod get_all;
|
mod files;
|
||||||
mod types;
|
mod types;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
pub mod get_all;
|
|
@ -2,14 +2,14 @@ use warp::{reply::{Reply, json}, reject::Rejection, Filter, http::StatusCode};
|
||||||
|
|
||||||
use crate::web::{state::SharedState, rejection::HttpReject};
|
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<Box<dyn Reply>, Rejection> {
|
pub async fn get_all(state: SharedState) -> Result<Box<dyn Reply>, Rejection> {
|
||||||
if ! state.config.api.enabled {
|
if ! state.config.api.enabled {
|
||||||
return Ok(
|
return Ok(
|
||||||
Box::new(
|
Box::new(
|
||||||
warp::reply::with_status(
|
warp::reply::with_status(
|
||||||
json(&ErrorMessage::new(super::types::Error::APIDisabled)),
|
json(&ErrorMessage::new(Error::APIDisabled)),
|
||||||
StatusCode::SERVICE_UNAVAILABLE
|
StatusCode::SERVICE_UNAVAILABLE
|
||||||
)
|
)
|
||||||
)
|
)
|
Loading…
Reference in New Issue