refactor: reorganize HtmlPageContext and update imports across modules
Some checks failed
CI / Check / Test (push) Failing after 46m33s

This commit is contained in:
2026-06-30 00:07:20 +02:00
parent 9c06fbd33e
commit 943a0abe54
13 changed files with 31 additions and 32 deletions

View File

@@ -89,10 +89,6 @@ impl ReviewLogger for DefaultReviewLogger {
}
}
#[cfg(test)]
#[path = "tests/review_logger.rs"]
mod tests;
async fn publish_events(
publisher: &Arc<dyn EventPublisher>,
movie: &Movie,
@@ -119,3 +115,7 @@ async fn publish_events(
publisher.publish(&review_event).await
}
#[cfg(test)]
#[path = "tests/review_logger.rs"]
mod tests;

View File

@@ -1,6 +1,7 @@
pub mod config;
pub mod jobs;
pub mod ports;
pub mod rendering;
pub mod worker;
pub mod auth;

View File

@@ -1,5 +1,4 @@
use async_trait::async_trait;
use uuid::Uuid;
use domain::errors::DomainError;
use domain::models::DiaryEntry;
@@ -11,24 +10,6 @@ pub trait ReviewLogger: Send + Sync {
async fn log_review(&self, cmd: LogReviewCommand) -> Result<(), DomainError>;
}
pub struct HtmlPageContext {
pub user_email: Option<String>,
pub user_id: Option<Uuid>,
pub is_admin: bool,
pub register_enabled: bool,
pub rss_url: String,
pub page_title: String,
pub canonical_url: String,
pub csrf_token: String,
pub page_rss_url: Option<String>,
}
impl HtmlPageContext {
pub fn is_current_user(&self, id: Uuid) -> bool {
self.user_id == Some(id)
}
}
pub trait RssFeedRenderer: Send + Sync {
fn render_feed(&self, entries: &[DiaryEntry], title: &str) -> Result<String, String>;
}

View File

@@ -0,0 +1,19 @@
use uuid::Uuid;
pub struct HtmlPageContext {
pub user_email: Option<String>,
pub user_id: Option<Uuid>,
pub is_admin: bool,
pub register_enabled: bool,
pub rss_url: String,
pub page_title: String,
pub canonical_url: String,
pub csrf_token: String,
pub page_rss_url: Option<String>,
}
impl HtmlPageContext {
pub fn is_current_user(&self, id: Uuid) -> bool {
self.user_id == Some(id)
}
}