diff options
author | fx <[email protected]> | 2023-10-24 01:15:22 +0200 |
---|---|---|
committer | fx <[email protected]> | 2023-10-24 01:15:22 +0200 |
commit | dcfb83fb2069bfcf4642b03453253e35479bf3da (patch) | |
tree | ccdacf40274227e86a8294558347aeea43b1724f /src/routes/device.rs | |
parent | d9d7b125e4fcaa3aedd7b57a69e6880e012ccf33 (diff) | |
download | webol-dcfb83fb2069bfcf4642b03453253e35479bf3da.tar webol-dcfb83fb2069bfcf4642b03453253e35479bf3da.tar.gz webol-dcfb83fb2069bfcf4642b03453253e35479bf3da.zip |
first ping impl baseline, doesnt work
Diffstat (limited to 'src/routes/device.rs')
-rw-r--r-- | src/routes/device.rs | 8 |
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 | } |