mirror of
https://github.com/agersant/polaris
synced 2025-03-02 06:17:10 +00:00
Added endpoints for recent and random albums
This commit is contained in:
parent
e7a5fcf01b
commit
91919a6628
1 changed files with 15 additions and 1 deletions
|
@ -26,7 +26,9 @@ pub fn get_routes() -> Vec<rocket::Route> {
|
|||
browse_root,
|
||||
browse,
|
||||
flatten_root,
|
||||
flatten
|
||||
flatten,
|
||||
random,
|
||||
recent,
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -188,3 +190,15 @@ fn flatten(
|
|||
let result = index::flatten::<DB>(&db, &path)?;
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
||||
#[get("/random")]
|
||||
fn random(db: State<DB>, _auth: Auth) -> Result<(Json<Vec<index::Directory>>), errors::Error> {
|
||||
let result = index::get_random_albums::<DB>(&db, 20)?;
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
||||
#[get("/recent")]
|
||||
fn recent(db: State<DB>, _auth: Auth) -> Result<(Json<Vec<index::Directory>>), errors::Error> {
|
||||
let result = index::get_recent_albums::<DB>(&db, 20)?;
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue