mirror of
https://codeberg.org/selfsigned-ash/antifed
synced 2026-09-18 10:38:14 +02:00
23 lines
521 B
Rust
23 lines
521 B
Rust
use diesel::PgConnection;
|
|
use diesel::r2d2::{ConnectionManager, Pool};
|
|
use lettre::SmtpTransport;
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
pub const DEFAULT_QUERY_LIMIT: i64 = 100;
|
|
|
|
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>>, mailer: SmtpTransport) -> Self {
|
|
Self {
|
|
db: pool,
|
|
mailer: Arc::new(Mutex::new(mailer)),
|
|
}
|
|
}
|
|
}
|