Refactor: Use doctate-common for shared logic
Moves shared types and utility functions to a new `doctate-common` crate. This includes: - API key header constant - AckResponse and AckStatus types - Timestamp formatting and parsing utilities This change centralizes common functionality, reducing duplication and improving maintainability. The `server` crate now depends on `doctate-common`.
This commit is contained in:
+2
-1
@@ -5,6 +5,7 @@ use std::time::Instant;
|
||||
use axum::extract::{FromRef, FromRequestParts};
|
||||
use axum::http::request::Parts;
|
||||
use axum_extra::extract::cookie::CookieJar;
|
||||
use doctate_common::API_KEY_HEADER;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::config::Config;
|
||||
@@ -43,7 +44,7 @@ where
|
||||
|
||||
let api_key = parts
|
||||
.headers
|
||||
.get("X-API-Key")
|
||||
.get(API_KEY_HEADER)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.ok_or(AppError::Unauthorized)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user