diff options
Diffstat (limited to 'src/handlers/ships.rs')
-rw-r--r-- | src/handlers/ships.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/handlers/ships.rs b/src/handlers/ships.rs index 91944fc..3101e54 100644 --- a/src/handlers/ships.rs +++ b/src/handlers/ships.rs @@ -8,7 +8,7 @@ use sqlx::{query, query_as, Error as SqlxError}; use tracing::log::warn; use crate::{ - errors::{JsonResult, ServiceError, StringResult}, + errors::{JsonResult, ServiceError, StringResult, StrResult}, State, }; @@ -31,7 +31,7 @@ pub async fn new( Json(new_ship): Json<Ship>, state: Extension<Arc<State>>, AuthBearer(token): AuthBearer, -) -> StringResult { +) -> StrResult { check_bearer(token)?; let mut conn = state.conn.acquire().await?; @@ -52,7 +52,7 @@ pub async fn delete( Path(shasum): Path<Sha256>, state: Extension<Arc<State>>, AuthBearer(token): AuthBearer, -) -> StringResult { +) -> StrResult { check_bearer(token)?; let mut conn = state.conn.acquire().await?; @@ -89,7 +89,7 @@ pub async fn get( Ok(Json(db_ship)) } -fn check_bearer(token: String) -> Result<(), ServiceError> { +pub fn check_bearer(token: String) -> Result<(), ServiceError> { let expected_token = match std::env::var("SHARED_KEY") { Ok(t) => t, Err(_) => { |