Add version to controller and api
This commit is contained in:
parent
f3d367e479
commit
4e97006919
7 changed files with 77 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ pub async fn update(
|
|||
.ok_or(DatabaseError::NotFound)?;
|
||||
|
||||
let controller = controller
|
||||
.update(&mut pool_conn, data.name.as_str(), controller.relay_count)
|
||||
.update(&mut pool_conn, data.name.as_str(), controller.relay_count, &controller.version)
|
||||
.await?;
|
||||
|
||||
let return_controller = Controller::from_db_model(&mut pool_conn, controller)?;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,24 @@
|
|||
use actix_web::{get, HttpResponse};
|
||||
use git_version::git_version;
|
||||
use serde_derive::Serialize;
|
||||
|
||||
pub mod controllers;
|
||||
pub mod macros;
|
||||
pub mod relays;
|
||||
pub mod schedules;
|
||||
pub mod tags;
|
||||
pub mod ws;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct VersionResponse {
|
||||
version: String,
|
||||
}
|
||||
|
||||
#[get("/version")]
|
||||
pub async fn version() -> HttpResponse {
|
||||
let version_response = VersionResponse {
|
||||
version: String::from(git_version!()),
|
||||
};
|
||||
|
||||
HttpResponse::Ok().json(version_response)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue