diff options
author | FxQnLr <[email protected]> | 2024-04-08 10:42:47 +0200 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-04-08 10:42:47 +0200 |
commit | d8060da1180545df5d03a76cd2860191ecf87507 (patch) | |
tree | be0c7812bd4a9a1ad6c8529072516a4a572ff17f /src/main.rs | |
parent | 8dca7e83519b6c3531653cdedf60b2a14e1035b7 (diff) | |
download | webol-d8060da1180545df5d03a76cd2860191ecf87507.tar webol-d8060da1180545df5d03a76cd2860191ecf87507.tar.gz webol-d8060da1180545df5d03a76cd2860191ecf87507.zip |
Closes #23. Start request id parameter put in path
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
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::{ | |||
11 | }; | 11 | }; |
12 | use dashmap::DashMap; | 12 | use dashmap::DashMap; |
13 | use sqlx::PgPool; | 13 | use sqlx::PgPool; |
14 | use time::UtcOffset; | ||
15 | use std::{env, sync::Arc}; | 14 | use std::{env, sync::Arc}; |
15 | use time::UtcOffset; | ||
16 | use tokio::sync::broadcast::{channel, Sender}; | 16 | use tokio::sync::broadcast::{channel, Sender}; |
17 | use tracing::{info, level_filters::LevelFilter}; | 17 | use tracing::{info, level_filters::LevelFilter}; |
18 | use tracing_subscriber::{ | 18 | use tracing_subscriber::{ |
@@ -38,13 +38,15 @@ mod wol; | |||
38 | #[openapi( | 38 | #[openapi( |
39 | paths( | 39 | paths( |
40 | start::start, | 40 | start::start, |
41 | start::start_payload, | ||
41 | device::get, | 42 | device::get, |
42 | device::get_path, | 43 | device::get_payload, |
43 | device::post, | 44 | device::post, |
44 | device::put, | 45 | device::put, |
45 | ), | 46 | ), |
46 | components( | 47 | components( |
47 | schemas( | 48 | schemas( |
49 | start::PayloadOld, | ||
48 | start::Payload, | 50 | start::Payload, |
49 | start::Response, | 51 | start::Response, |
50 | device::PutDevicePayload, | 52 | device::PutDevicePayload, |
@@ -116,12 +118,13 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
116 | }; | 118 | }; |
117 | 119 | ||
118 | let app = Router::new() | 120 | let app = Router::new() |
119 | .route("/start", post(start::start)) | 121 | .route("/start", post(start::start_payload)) |
122 | .route("/start/:id", post(start::start)) | ||
120 | .route( | 123 | .route( |
121 | "/device", | 124 | "/device", |
122 | post(device::post).get(device::get).put(device::put), | 125 | post(device::post).get(device::get_payload).put(device::put), |
123 | ) | 126 | ) |
124 | .route("/device/:id", get(device::get_path)) | 127 | .route("/device/:id", get(device::get)) |
125 | .route("/status", get(status::status)) | 128 | .route("/status", get(status::status)) |
126 | .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) | 129 | .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) |
127 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | 130 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) |