systemprompt_users/repository/banned_ip/
mod.rs1mod listing;
12mod queries;
13mod types;
14
15use std::sync::Arc;
16
17use sqlx::PgPool;
18use systemprompt_database::DbPool;
19
20pub use types::{BanDuration, BanIpParams, BanIpWithMetadataParams, BannedIp};
21
22#[derive(Clone, Debug)]
23pub struct BannedIpRepository {
24 pool: Arc<PgPool>,
25 write_pool: Arc<PgPool>,
26}
27
28impl BannedIpRepository {
29 pub fn new(db: &DbPool) -> Self {
30 let pool = db.pool();
31 let write_pool = db.write_pool();
32 Self { pool, write_pool }
33 }
34
35 pub fn from_pool(pool: Arc<PgPool>) -> Self {
36 let write_pool = Arc::clone(&pool);
37 Self { pool, write_pool }
38 }
39}