artist image
This commit is contained in:
parent
92df85a4bb
commit
96cd6ed0ef
3 changed files with 37 additions and 2 deletions
|
@ -2,6 +2,7 @@ use super::api_error;
|
|||
use super::to_api;
|
||||
use super::FallibleApiResponse;
|
||||
use super::ToAPI;
|
||||
use fs::NamedFile;
|
||||
use mongod::Model;
|
||||
use mongodb::bson::doc;
|
||||
use rocket::*;
|
||||
|
@ -16,6 +17,12 @@ pub async fn artists_route(lib: &State<Libary>) -> FallibleApiResponse {
|
|||
Ok(serde_json::to_value(&to_api(&artists).await).unwrap())
|
||||
}
|
||||
|
||||
#[get("/artist/<id>/image")]
|
||||
pub async fn artist_image_route(id: &str) -> Option<NamedFile> {
|
||||
let image = Artist::get_image_of(id).await?;
|
||||
NamedFile::open(image).await.ok()
|
||||
}
|
||||
|
||||
#[get("/artist/<id>")]
|
||||
pub async fn artist_route(id: &str) -> FallibleApiResponse {
|
||||
Ok(Artist::get(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue