aboutsummaryrefslogtreecommitdiff
path: root/src/routes/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/device.rs')
-rw-r--r--src/routes/device.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/routes/device.rs b/src/routes/device.rs
index 025c7d0..248d1e0 100644
--- a/src/routes/device.rs
+++ b/src/routes/device.rs
@@ -21,7 +21,7 @@ pub async fn get_device(State(state): State<Arc<crate::AppState>>, headers: Head
21 WHERE id = $1; 21 WHERE id = $1;
22 "#, 22 "#,
23 payload.id 23 payload.id
24 ).fetch_one(&state.db).await.map_err(|err| WebolError::Server(Box::new(err)))?; 24 ).fetch_one(&state.db).await.map_err(WebolError::DB)?;
25 25
26 Ok(Json(json!(device))) 26 Ok(Json(json!(device)))
27 } else { 27 } else {
@@ -46,7 +46,7 @@ pub async fn put_device(State(state): State<Arc<crate::AppState>>, headers: Head
46 payload.id, 46 payload.id,
47 payload.mac, 47 payload.mac,
48 payload.broadcast_addr 48 payload.broadcast_addr
49 ).execute(&state.db).await.map_err(|err| WebolError::Server(Box::new(err)))?; 49 ).execute(&state.db).await.map_err(WebolError::DB)?;
50 50
51 Ok(Json(json!(PutDeviceResponse { success: true }))) 51 Ok(Json(json!(PutDeviceResponse { success: true })))
52 } else { 52 } else {
@@ -80,7 +80,7 @@ pub async fn post_device(State(state): State<Arc<crate::AppState>>, headers: Hea
80 payload.mac, 80 payload.mac,
81 payload.broadcast_addr, 81 payload.broadcast_addr,
82 payload.id 82 payload.id
83 ).fetch_one(&state.db).await.map_err(|err| WebolError::Server(Box::new(err)))?; 83 ).fetch_one(&state.db).await.map_err(WebolError::DB)?;
84 84
85 Ok(Json(json!(device))) 85 Ok(Json(json!(device)))
86 } else { 86 } else {
@@ -93,4 +93,4 @@ pub struct PostDevicePayload {
93 id: String, 93 id: String,
94 mac: String, 94 mac: String,
95 broadcast_addr: String, 95 broadcast_addr: String,
96} \ No newline at end of file 96}