From 6648d1da1df9a4e4e2945739fc0fd3c7f77643cb Mon Sep 17 00:00:00 2001 From: fx Date: Sat, 14 Oct 2023 22:01:33 +0200 Subject: test this fing shit on pi wohoo --- src/routes/device.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/routes/device.rs') diff --git a/src/routes/device.rs b/src/routes/device.rs index d5d7144..025c7d0 100644 --- a/src/routes/device.rs +++ b/src/routes/device.rs @@ -4,11 +4,13 @@ use axum::headers::HeaderMap; use axum::Json; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; +use tracing::info; use crate::auth::auth; use crate::db::Device; use crate::error::WebolError; pub async fn get_device(State(state): State>, headers: HeaderMap, Json(payload): Json) -> Result, WebolError> { + info!("GET request"); let secret = headers.get("authorization"); if auth(secret).map_err(WebolError::Auth)? { let device = sqlx::query_as!( @@ -33,6 +35,7 @@ pub struct GetDevicePayload { } pub async fn put_device(State(state): State>, headers: HeaderMap, Json(payload): Json) -> Result, WebolError> { + info!("PUT request"); let secret = headers.get("authorization"); if auth(secret).map_err(WebolError::Auth)? { sqlx::query!( @@ -64,6 +67,7 @@ pub struct PutDeviceResponse { } pub async fn post_device(State(state): State>, headers: HeaderMap, Json(payload): Json) -> Result, WebolError> { + info!("POST request"); let secret = headers.get("authorization"); if auth(secret).map_err(WebolError::Auth)? { let device = sqlx::query_as!( -- cgit v1.2.3