Skip to main content

systemprompt_users/repository/
mod.rs

1mod banned_ip;
2mod user;
3
4pub use banned_ip::{
5    BanDuration, BanIpParams, BanIpWithMetadataParams, BannedIp, BannedIpRepository,
6};
7pub use user::{MergeResult, UpdateUserParams};
8
9use anyhow::Result;
10use sqlx::PgPool;
11use std::sync::Arc;
12use systemprompt_database::DbPool;
13
14pub(crate) const MAX_PAGE_SIZE: i64 = 100;
15
16#[derive(Debug, Clone)]
17pub struct UserRepository {
18    pool: Arc<PgPool>,
19}
20
21impl UserRepository {
22    pub fn new(db: &DbPool) -> Result<Self> {
23        let pool = db.pool_arc()?;
24        Ok(Self { pool })
25    }
26}