Add swagger-ui

This commit is contained in:
Tobias Reisinger 2024-04-22 03:41:41 +02:00
parent 51c42d5202
commit e950a33e98
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
9 changed files with 263 additions and 44 deletions
emgauwa-core/src/handlers/v1

View file

@ -9,7 +9,7 @@ use sqlx::{Pool, Sqlite};
use crate::app_state;
use crate::app_state::AppState;
#[get("/api/v1/controllers")]
#[get("/controllers")]
pub async fn index(pool: web::Data<Pool<Sqlite>>) -> Result<HttpResponse, EmgauwaError> {
let mut pool_conn = pool.acquire().await?;
@ -20,7 +20,7 @@ pub async fn index(pool: web::Data<Pool<Sqlite>>) -> Result<HttpResponse, Emgauw
Ok(HttpResponse::Ok().json(controllers))
}
#[get("/api/v1/controllers/{controller_id}")]
#[get("/controllers/{controller_id}")]
pub async fn show(
pool: web::Data<Pool<Sqlite>>,
path: web::Path<(String,)>,
@ -38,7 +38,7 @@ pub async fn show(
Ok(HttpResponse::Ok().json(return_controller))
}
#[put("/api/v1/controllers/{controller_id}")]
#[put("/controllers/{controller_id}")]
pub async fn update(
pool: web::Data<Pool<Sqlite>>,
app_state: web::Data<Addr<AppState>>,
@ -70,7 +70,7 @@ pub async fn update(
Ok(HttpResponse::Ok().json(return_controller))
}
#[delete("/api/v1/controllers/{controller_id}")]
#[delete("/controllers/{controller_id}")]
pub async fn delete(
pool: web::Data<Pool<Sqlite>>,
app_state: web::Data<Addr<AppState>>,