aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
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};
12use dashmap::DashMap; 12use dashmap::DashMap;
13use sqlx::PgPool; 13use sqlx::PgPool;
14use time::UtcOffset;
15use std::{env, sync::Arc}; 14use std::{env, sync::Arc};
15use time::UtcOffset;
16use tokio::sync::broadcast::{channel, Sender}; 16use tokio::sync::broadcast::{channel, Sender};
17use tracing::{info, level_filters::LevelFilter}; 17use tracing::{info, level_filters::LevelFilter};
18use tracing_subscriber::{ 18use 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()))