refactor: reorganize HtmlPageContext and update imports across modules
Some checks failed
CI / Check / Test (push) Failing after 46m33s
Some checks failed
CI / Check / Test (push) Failing after 46m33s
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
pub mod config;
|
||||
pub mod jobs;
|
||||
pub mod ports;
|
||||
pub mod rendering;
|
||||
pub mod worker;
|
||||
|
||||
pub mod auth;
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
|
||||
19
crates/application/src/rendering.rs
Normal file
19
crates/application/src/rendering.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user