feat: ship blog platform admin and deploy stack
This commit is contained in:
26
backend/src/tasks/send_weekly_digest.rs
Normal file
26
backend/src/tasks/send_weekly_digest.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use loco_rs::prelude::*;
|
||||
|
||||
use crate::services::subscriptions;
|
||||
|
||||
pub struct SendWeeklyDigest;
|
||||
|
||||
#[async_trait]
|
||||
impl Task for SendWeeklyDigest {
|
||||
fn task(&self) -> TaskInfo {
|
||||
TaskInfo {
|
||||
name: "send_weekly_digest".to_string(),
|
||||
detail: "queue weekly digest notifications".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
async fn run(&self, app_context: &AppContext, _vars: &task::Vars) -> Result<()> {
|
||||
let summary = subscriptions::send_digest(app_context, "weekly").await?;
|
||||
tracing::info!(
|
||||
"send_weekly_digest queued={} skipped={} posts={}",
|
||||
summary.queued,
|
||||
summary.skipped,
|
||||
summary.post_count
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user