From d8060da1180545df5d03a76cd2860191ecf87507 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Mon, 8 Apr 2024 10:42:47 +0200 Subject: Closes #23. Start request id parameter put in path --- src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 00fc6ce..75f491a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,8 +11,8 @@ use axum::{ }; use dashmap::DashMap; use sqlx::PgPool; -use time::UtcOffset; use std::{env, sync::Arc}; +use time::UtcOffset; use tokio::sync::broadcast::{channel, Sender}; use tracing::{info, level_filters::LevelFilter}; use tracing_subscriber::{ @@ -38,13 +38,15 @@ mod wol; #[openapi( paths( start::start, + start::start_payload, device::get, - device::get_path, + device::get_payload, device::post, device::put, ), components( schemas( + start::PayloadOld, start::Payload, start::Response, device::PutDevicePayload, @@ -116,12 +118,13 @@ async fn main() -> color_eyre::eyre::Result<()> { }; let app = Router::new() - .route("/start", post(start::start)) + .route("/start", post(start::start_payload)) + .route("/start/:id", post(start::start)) .route( "/device", - post(device::post).get(device::get).put(device::put), + post(device::post).get(device::get_payload).put(device::put), ) - .route("/device/:id", get(device::get_path)) + .route("/device/:id", get(device::get)) .route("/status", get(status::status)) .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) -- cgit v1.2.3