Implement all API according to swagger spec #27

Merged
blek merged 16 commits from delete-upload-api-methods into 0.2-dev 2023-12-14 11:56:46 +01:00
1 changed files with 17 additions and 2 deletions
Showing only changes of commit 67b670e072 - Show all commits

View File

@ -1,4 +1,4 @@
use std::{collections::HashMap, net::IpAddr}; use std::net::IpAddr;
use serde_json::json; use serde_json::json;
use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode}; use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode};
@ -105,7 +105,22 @@ pub async fn delete(state: SharedState, body: DeleteFunctionPayload, ip: Option<
) )
} }
file.delete(state).await; let res = file.delete(state).await;
if let Err(err) = res {
return Ok(
Box::new(
with_status(
json(
&ErrorMessage {
error: Error::APIError,
details: Some(format!("Couldn't delete file: {}", err))
}
),
StatusCode::INTERNAL_SERVER_ERROR
)
)
)
}
Ok(Box::new(json(&json!({})))) Ok(Box::new(json(&json!({}))))
} }