Compare commits
3
Commits
main
...
f235073641
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f235073641
|
||
|
|
5a4ba40064
|
||
|
|
0f1c3bb70f
|
Generated
+2
-2
@@ -1937,8 +1937,8 @@ checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "labyrinth"
|
name = "labyrinth"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.2-1-84f98521c8-928#84f98521c8c98693e422db48eb0aa7c124c2586b"
|
source = "git+ssh://git@git.kundeng.us/phoenix/labyrinth.git?tag=v0.0.3-3-f99a77ece0-928#f99a77ece0d066ee96867936eb280db367354e0a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-config",
|
"aws-config",
|
||||||
"aws-sdk-s3",
|
"aws-sdk-s3",
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
|||||||
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
|
simeta = { git = "ssh://git@git.kundeng.us/phoenix/simeta.git", tag = "v0.6.1-main-b690995806-680" }
|
||||||
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
|
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" }
|
||||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" }
|
||||||
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.2-1-84f98521c8-928" }
|
labyrinth = { git = "ssh://git@git.kundeng.us/phoenix/labyrinth.git", tag = "v0.0.3-3-f99a77ece0-928" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
common-multipart-rfc7578 = { version = "0.7.0" }
|
common-multipart-rfc7578 = { version = "0.7.0" }
|
||||||
|
|||||||
@@ -212,6 +212,31 @@ pub mod endpoint {
|
|||||||
match lr.upload(&file_path, &data).await {
|
match lr.upload(&file_path, &data).await {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
println!("Result: {res:?}");
|
println!("Result: {res:?}");
|
||||||
|
|
||||||
|
println!("Downloading file");
|
||||||
|
match lr.download(&file_path).await {
|
||||||
|
Ok(res) => {
|
||||||
|
if res.is_empty() {
|
||||||
|
println!("This should not be empty");
|
||||||
|
} else {
|
||||||
|
println!("Size: {:?}", res.len());
|
||||||
|
println!("Going to delete file");
|
||||||
|
|
||||||
|
match lr.delete(&file_path).await {
|
||||||
|
Ok(res) => {
|
||||||
|
println!("Result: {res:?}");
|
||||||
|
println!("Deleted");
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Error: {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
labyrinth::Error::Info(err_str) => {
|
labyrinth::Error::Info(err_str) => {
|
||||||
|
|||||||
+64
-1
@@ -437,13 +437,30 @@ mod tests {
|
|||||||
pub async fn get_queued_coverart(
|
pub async fn get_queued_coverart(
|
||||||
app: &axum::Router,
|
app: &axum::Router,
|
||||||
coverart_queue_id: &uuid::Uuid,
|
coverart_queue_id: &uuid::Uuid,
|
||||||
) -> Result<axum::response::Response, std::convert::Infallible> {
|
) -> Result<axum::response::Response, axum::http::Error> {
|
||||||
let uri = format!(
|
let uri = format!(
|
||||||
"{}?id={}",
|
"{}?id={}",
|
||||||
crate::callers::queue::endpoints::QUEUECOVERART,
|
crate::callers::queue::endpoints::QUEUECOVERART,
|
||||||
coverart_queue_id
|
coverart_queue_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
match run_post(None, &uri, axum::http::Method::GET, false).await {
|
||||||
|
Ok(request) => match app.clone().oneshot(request).await {
|
||||||
|
Ok(response) => {
|
||||||
|
Ok(response)
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
Err(axum::http::Error::from(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
Err(err)
|
||||||
|
// Err(std::convert::Infallible::from(err))
|
||||||
|
// Err(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
let req = axum::http::Request::builder()
|
let req = axum::http::Request::builder()
|
||||||
.method(axum::http::Method::GET)
|
.method(axum::http::Method::GET)
|
||||||
.uri(uri)
|
.uri(uri)
|
||||||
@@ -456,6 +473,52 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
app.clone().oneshot(req).await
|
app.clone().oneshot(req).await
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum ReqBody {
|
||||||
|
Json(serde_json::Value),
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn run_post(
|
||||||
|
// payload: Option<&serde_json::Value>,
|
||||||
|
payload: Option<ReqBody>,
|
||||||
|
uri: &str,
|
||||||
|
method: axum::http::Method,
|
||||||
|
has_body: bool,
|
||||||
|
) -> Result<axum::http::Request<axum::body::Body>, axum::http::Error> {
|
||||||
|
let body = if has_body {
|
||||||
|
assert_eq!(
|
||||||
|
true,
|
||||||
|
payload.is_some(),
|
||||||
|
"Has request body and payload has data"
|
||||||
|
);
|
||||||
|
// axum::body::Body::from(payload.unwrap().to_string())
|
||||||
|
match payload.unwrap() {
|
||||||
|
ReqBody::Json(val) => {
|
||||||
|
axum::body::Body::from(val.to_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
axum::body::Body::empty()
|
||||||
|
};
|
||||||
|
match axum::http::Request::builder()
|
||||||
|
.method(method)
|
||||||
|
.uri(uri)
|
||||||
|
.header(
|
||||||
|
axum::http::header::CONTENT_TYPE,
|
||||||
|
"application/json; charset=utf-8",
|
||||||
|
)
|
||||||
|
.header(
|
||||||
|
axum::http::header::AUTHORIZATION,
|
||||||
|
super::bearer_auth().await,
|
||||||
|
)
|
||||||
|
.body(body)
|
||||||
|
{
|
||||||
|
Ok(t) => Ok(t),
|
||||||
|
Err(err) => Err(err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user