This commit is contained in:
JMARyA 2024-08-16 12:33:32 +02:00
parent a1b597ef68
commit c97f6168a1
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -9,6 +9,7 @@ use crate::check_admin;
use crate::library::track::Track;
use crate::library::user::User;
use crate::library::Libary;
use crate::route::to_api;
#[get("/library/clean")]
pub async fn clean_library(lib: &State<Libary>, u: User) -> FallibleApiResponse {
@ -23,12 +24,13 @@ pub async fn get_singles_route(u: User) -> FallibleApiResponse {
let singles = Track::find(doc! { "album_id": None::<String>}, None)
.await
.unwrap();
Ok(json!(singles))
Ok(json!(to_api(&singles).await))
}
#[get("/library/orphans")]
pub async fn get_orphans_route(u: User) -> FallibleApiResponse {
check_admin!(u);
let orphans = Track::get_orphans().await;
Ok(json!(orphans))
Ok(json!(to_api(&orphans).await))
}