chore: add get_animation_by_name
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Andre Henriques 2023-07-10 14:59:11 +01:00
parent 858d0aca66
commit 94d716ef9c
2 changed files with 12 additions and 0 deletions

View File

@ -362,6 +362,17 @@ pub async fn start_animation(
create_message(200, "Started animation") create_message(200, "Started animation")
} }
#[get("/animation/<name>")]
pub async fn get_animation_by_name(name: &str, db: &State<DBPool>) -> String {
let animation = get_animation_or_string_error(name, db);
if let Err(animation) = animation {
return animation;
}
let animation = animation.unwrap();
json!(animation).to_string()
}
/** /**
* *
* Clear animations * Clear animations

View File

@ -233,6 +233,7 @@ async fn main() -> GResult {
animations::get_animation_request, animations::get_animation_request,
animations::toggle_animation, animations::toggle_animation,
animations::get_animations, animations::get_animations,
animations::get_animation_by_name,
], ],
) )
.manage(conn_pool_arc.clone()) .manage(conn_pool_arc.clone())