systemprompt_users/repository/
mod.rs1mod 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 write_pool: Arc<PgPool>,
20}
21
22impl UserRepository {
23 pub fn new(db: &DbPool) -> Result<Self> {
24 let pool = db.pool_arc()?;
25 let write_pool = db.write_pool_arc()?;
26 Ok(Self { pool, write_pool })
27 }
28}