Adds mailer library

This commit is contained in:
2026-07-26 10:55:59 +02:00
parent 7f9702fed7
commit f338a9d964
4 changed files with 43 additions and 4 deletions
+8 -2
View File
@@ -1,5 +1,7 @@
use diesel::PgConnection;
use diesel::r2d2::{ConnectionManager, Pool};
use lettre::SmtpTransport;
use std::sync::{Arc, Mutex};
pub const DEFAULT_QUERY_LIMIT: i64 = 100;
@@ -7,10 +9,14 @@ pub mod action;
pub struct AppState {
pub db: Pool<ConnectionManager<PgConnection>>,
pub mailer: Arc<Mutex<SmtpTransport>>,
}
impl AppState {
pub fn new(pool: Pool<ConnectionManager<PgConnection>>) -> Self {
Self { db: pool }
pub fn new(pool: Pool<ConnectionManager<PgConnection>>, mailer: SmtpTransport) -> Self {
Self {
db: pool,
mailer: Arc::new(Mutex::new(mailer)),
}
}
}