Code formatting
This commit is contained in:
@@ -9,10 +9,7 @@ pub mod response {
|
|||||||
mod db {
|
mod db {
|
||||||
use sqlx::Row;
|
use sqlx::Row;
|
||||||
|
|
||||||
pub async fn insert(
|
pub async fn insert(pool: &sqlx::PgPool, data: &Vec<u8>) -> Result<uuid::Uuid, sqlx::Error> {
|
||||||
pool: &sqlx::PgPool,
|
|
||||||
data: &Vec<u8>,
|
|
||||||
) -> Result<uuid::Uuid, sqlx::Error> {
|
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
INSERT INTO "coverartQueue" (data) VALUES($1) RETURNING id;
|
INSERT INTO "coverartQueue" (data) VALUES($1) RETURNING id;
|
||||||
@@ -76,9 +73,7 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => (axum::http::StatusCode::BAD_REQUEST, axum::Json(response)),
|
||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
|
||||||
}
|
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
response.message = err.to_string();
|
response.message = err.to_string();
|
||||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
|
|||||||
+7
-3
@@ -622,14 +622,18 @@ mod tests {
|
|||||||
let body = MultipartBody::from(form);
|
let body = MultipartBody::from(form);
|
||||||
|
|
||||||
// Send request
|
// Send request
|
||||||
match app.clone().oneshot(
|
match app
|
||||||
|
.clone()
|
||||||
|
.oneshot(
|
||||||
axum::http::Request::builder()
|
axum::http::Request::builder()
|
||||||
.method(axum::http::Method::POST)
|
.method(axum::http::Method::POST)
|
||||||
.uri(crate::callers::endpoints::QUEUECOVERART)
|
.uri(crate::callers::endpoints::QUEUECOVERART)
|
||||||
.header(axum::http::header::CONTENT_TYPE, content_type)
|
.header(axum::http::header::CONTENT_TYPE, content_type)
|
||||||
.body(axum::body::Body::from_stream(body))
|
.body(axum::body::Body::from_stream(body))
|
||||||
.unwrap()
|
.unwrap(),
|
||||||
).await {
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
Ok(response) => {
|
Ok(response) => {
|
||||||
let resp =
|
let resp =
|
||||||
get_resp_data::<crate::callers::coverart::response::Response>(response).await;
|
get_resp_data::<crate::callers::coverart::response::Response>(response).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user