Improve api schema

This commit is contained in:
Tobias Reisinger 2024-05-04 18:34:26 +02:00
parent f23bb48fa1
commit f9ad8f9399
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
9 changed files with 123 additions and 164 deletions
src/handlers/v1

View file

@ -12,6 +12,7 @@ use emgauwa_common::types::{
use crate::app_state;
use crate::app_state::AppState;
use crate::handlers::EmgauwaMessage;
#[get("/macros")]
pub async fn index(pool: web::Data<Pool<Sqlite>>) -> Result<HttpResponse, EmgauwaError> {
@ -98,7 +99,7 @@ pub async fn delete(
let uid = EmgauwaUid::try_from(macro_uid.as_str())?;
DbMacro::delete_by_uid(&mut pool_conn, uid).await?;
Ok(HttpResponse::Ok().json("macro got deleted"))
Ok(HttpResponse::Ok().emgauwa_message("macro got deleted"))
}
#[put("/macros/{macro_id}/execute")]
@ -160,5 +161,5 @@ pub async fn execute(
.await??;
}
Ok(HttpResponse::Ok().finish()) // TODO add a message?
Ok(HttpResponse::Ok().emgauwa_message("macro got executed"))
}