synthwave/src/route/admin.rs

17 lines
401 B
Rust
Raw Normal View History

2024-08-12 23:52:16 +00:00
use super::api_error;
use super::FallibleApiResponse;
use mongodb::bson::doc;
use rocket::{get, State};
use serde_json::json;
use crate::check_admin;
use crate::library::user::User;
use crate::library::Libary;
#[get("/library/clean")]
pub async fn clean_library(lib: &State<Libary>, u: User) -> FallibleApiResponse {
check_admin!(u);
lib.clean_lost_files().await;
Ok(json!({"ok": 1}))
}