mirror of
https://codeberg.org/selfsigned-ash/antifed
synced 2026-09-18 10:38:14 +02:00
➕ Adds mailer library
This commit is contained in:
@@ -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)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user