+12
-29
@@ -127,41 +127,24 @@ pub mod endpoint {
|
||||
coverart.title = song.album.clone();
|
||||
coverart.file_type = file_type.file_type;
|
||||
coverart.data = data.raw_data;
|
||||
coverart.file_key = new_file_key;
|
||||
|
||||
match coverart.save_to_filesystem() {
|
||||
Ok(_) => {
|
||||
match repo::coverart::create(
|
||||
&pool,
|
||||
&coverart,
|
||||
&payload.song_id,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(id) => {
|
||||
coverart.song_id = payload.song_id;
|
||||
coverart.id = id;
|
||||
println!("Cover Art created");
|
||||
match repo::coverart::create(&pool, &coverart, &payload.song_id)
|
||||
.await
|
||||
{
|
||||
Ok(id) => {
|
||||
coverart.song_id = payload.song_id;
|
||||
coverart.id = id;
|
||||
println!("Cover Art created");
|
||||
|
||||
response.message = String::from("Successful");
|
||||
response.data.push(coverart);
|
||||
response.message = String::from("Successful");
|
||||
response.data.push(coverart);
|
||||
|
||||
(axum::http::StatusCode::OK, axum::Json(response))
|
||||
}
|
||||
Err(err) => {
|
||||
response.message = err.to_string();
|
||||
(
|
||||
axum::http::StatusCode::BAD_REQUEST,
|
||||
axum::Json(response),
|
||||
)
|
||||
}
|
||||
}
|
||||
(axum::http::StatusCode::OK, axum::Json(response))
|
||||
}
|
||||
Err(err) => {
|
||||
response.message = err.to_string();
|
||||
(
|
||||
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
axum::Json(response),
|
||||
)
|
||||
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user