clean(presentation): strip comments, kill dead code, extract constants

- remove all doc/inline comments
- delete unused ApiError variants (AuthRequired, NotImplemented) and helpers (internal, not_implemented)
- prefix lifetime-only AppState fields with _ to suppress dead_code warning
- extract magic numbers: TICK_INTERVAL_SECS, EXPIRY_THRESHOLD_HOURS, POLL_INTERVAL_SECS, EVENT_BUS_CAPACITY, DEFAULT_ACTIVITY_LIMIT, DEFAULT_SEARCH_LIMIT, etc
- replace inline serde_json::json! in sync_status with typed SyncStatusEntry
- fix mid-file import in schedule handler
- fix extractors: strip_prefix instead of magic offset 6
- fix unreachable pattern in wire_repositories with cfg guard
- use eq_ignore_ascii_case for content-type header check
This commit is contained in:
2026-07-12 04:35:54 +02:00
parent 25b33b6a0e
commit ff5f299a84
21 changed files with 91 additions and 296 deletions

View File

@@ -1,7 +1,3 @@
//! WebhookConsumer background task.
//!
//! Subscribes to domain events and delivers them to per-channel webhook URLs.
use std::sync::Arc;
use chrono::Utc;
@@ -13,7 +9,8 @@ use uuid::Uuid;
use domain::events::DomainEvent;
use domain::ports::ChannelQuery;
/// Consumes domain events and delivers them to per-channel webhook URLs.
const DEFAULT_CONTENT_TYPE: &str = "application/json";
pub async fn run(
mut rx: broadcast::Receiver<DomainEvent>,
channel_query: Arc<dyn ChannelQuery>,
@@ -177,7 +174,7 @@ async fn post_webhook(
if let Some(h) = headers_json {
if let Ok(map) = serde_json::from_str::<serde_json::Map<String, Value>>(h) {
for (k, v) in &map {
if k.to_lowercase() == "content-type" {
if k.eq_ignore_ascii_case("content-type") {
has_content_type = true;
}
if let Some(v_str) = v.as_str() {
@@ -188,7 +185,7 @@ async fn post_webhook(
}
if !has_content_type {
req = req.header("Content-Type", "application/json");
req = req.header("Content-Type", DEFAULT_CONTENT_TYPE);
}
match req.send().await {