summaryrefslogtreecommitdiff
path: root/src/routes/start.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2024-03-05 13:16:18 +0100
committerGitHub <[email protected]>2024-03-05 13:16:18 +0100
commit8dca7e83519b6c3531653cdedf60b2a14e1035b7 (patch)
tree0180a452dd354b067470618e6dbdc330649287cb /src/routes/start.rs
parentf0dc13f907a72ffef44f89b5e197567db129b020 (diff)
parent85c63c2ca8448428e2db93cb9d4f284a4e314ed7 (diff)
downloadwebol-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.rs16
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;
6use axum::Json; 6use axum::Json;
7use serde::{Deserialize, Serialize}; 7use serde::{Deserialize, Serialize};
8use serde_json::{json, Value}; 8use serde_json::{json, Value};
9use utoipa::ToSchema;
9use std::sync::Arc; 10use std::sync::Arc;
10use tracing::{debug, info}; 11use tracing::{debug, info};
11use uuid::Uuid; 12use 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)]
13pub async fn start( 23pub 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)]
92pub struct Payload { 102pub 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)]
98struct Response { 108pub struct Response {
99 id: String, 109 id: String,
100 boot: bool, 110 boot: bool,
101 uuid: Option<String>, 111 uuid: Option<String>,