summaryrefslogtreecommitdiff
path: root/src/routes/start.rs
diff options
context:
space:
mode:
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>,