tsk-227: Change statement when evaluating multipart form when queueing song
This commit is contained in:
@@ -139,7 +139,9 @@ pub mod endpoint {
|
|||||||
let mut results: Vec<uuid::Uuid> = Vec::new();
|
let mut results: Vec<uuid::Uuid> = Vec::new();
|
||||||
let mut response = super::response::song_queue::Response::default();
|
let mut response = super::response::song_queue::Response::default();
|
||||||
|
|
||||||
while let Some(field) = multipart.next_field().await.unwrap() {
|
match multipart.next_field().await {
|
||||||
|
Ok(multipart_field) => {
|
||||||
|
if let Some(field) = multipart_field {
|
||||||
let name = field.name().unwrap().to_string();
|
let name = field.name().unwrap().to_string();
|
||||||
let file_name = field.file_name().unwrap().to_string();
|
let file_name = field.file_name().unwrap().to_string();
|
||||||
let content_type = field.content_type().unwrap().to_string();
|
let content_type = field.content_type().unwrap().to_string();
|
||||||
@@ -189,7 +191,6 @@ pub mod endpoint {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response.data = results;
|
response.data = results;
|
||||||
response.message = if response.data.is_empty() {
|
response.message = if response.data.is_empty() {
|
||||||
@@ -197,8 +198,17 @@ pub mod endpoint {
|
|||||||
} else {
|
} else {
|
||||||
String::from(super::super::super::response::SUCCESSFUL)
|
String::from(super::super::super::response::SUCCESSFUL)
|
||||||
};
|
};
|
||||||
|
|
||||||
(axum::http::StatusCode::CREATED, axum::Json(response))
|
(axum::http::StatusCode::CREATED, axum::Json(response))
|
||||||
|
} else {
|
||||||
|
response.message = String::from("No field found in multipart");
|
||||||
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
response.message = err.to_string();
|
||||||
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Endpoint to link a user id to a queued song
|
/// Endpoint to link a user id to a queued song
|
||||||
|
|||||||
Reference in New Issue
Block a user