diff options
author | FxQnLr <[email protected]> | 2024-03-05 13:16:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-05 13:16:18 +0100 |
commit | 8dca7e83519b6c3531653cdedf60b2a14e1035b7 (patch) | |
tree | 0180a452dd354b067470618e6dbdc330649287cb /src/routes/start.rs | |
parent | f0dc13f907a72ffef44f89b5e197567db129b020 (diff) | |
parent | 85c63c2ca8448428e2db93cb9d4f284a4e314ed7 (diff) | |
download | webol-8dca7e83519b6c3531653cdedf60b2a14e1035b7.tar webol-8dca7e83519b6c3531653cdedf60b2a14e1035b7.tar.gz webol-8dca7e83519b6c3531653cdedf60b2a14e1035b7.zip |
Merge pull request #22 from FxQnLr/0.3.3
0.3.3
Diffstat (limited to 'src/routes/start.rs')
-rw-r--r-- | src/routes/start.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/routes/start.rs b/src/routes/start.rs index d4c0802..ef6e8f2 100644 --- a/src/routes/start.rs +++ b/src/routes/start.rs | |||
@@ -6,10 +6,20 @@ use axum::extract::State; | |||
6 | use axum::Json; | 6 | use axum::Json; |
7 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
8 | use serde_json::{json, Value}; | 8 | use serde_json::{json, Value}; |
9 | use utoipa::ToSchema; | ||
9 | use std::sync::Arc; | 10 | use std::sync::Arc; |
10 | use tracing::{debug, info}; | 11 | use tracing::{debug, info}; |
11 | use uuid::Uuid; | 12 | use uuid::Uuid; |
12 | 13 | ||
14 | #[utoipa::path( | ||
15 | post, | ||
16 | path = "/start", | ||
17 | request_body = Payload, | ||
18 | responses( | ||
19 | (status = 200, description = "List matching todos by query", body = [Response]) | ||
20 | ), | ||
21 | security(("api_key" = [])) | ||
22 | )] | ||
13 | pub async fn start( | 23 | pub async fn start( |
14 | State(state): State<Arc<crate::AppState>>, | 24 | State(state): State<Arc<crate::AppState>>, |
15 | Json(payload): Json<Payload>, | 25 | Json(payload): Json<Payload>, |
@@ -88,14 +98,14 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
88 | uuid_ret | 98 | uuid_ret |
89 | } | 99 | } |
90 | 100 | ||
91 | #[derive(Deserialize)] | 101 | #[derive(Deserialize, ToSchema)] |
92 | pub struct Payload { | 102 | pub struct Payload { |
93 | id: String, | 103 | id: String, |
94 | ping: Option<bool>, | 104 | ping: Option<bool>, |
95 | } | 105 | } |
96 | 106 | ||
97 | #[derive(Serialize)] | 107 | #[derive(Serialize, ToSchema)] |
98 | struct Response { | 108 | pub struct Response { |
99 | id: String, | 109 | id: String, |
100 | boot: bool, | 110 | boot: bool, |
101 | uuid: Option<String>, | 111 | uuid: Option<String>, |