systemprompt_users/repository/
mod.rs1mod api_key;
10mod banned_ip;
11mod device_cert;
12mod federated_identity;
13mod user;
14
15pub use api_key::CreateApiKeyParams;
16pub use banned_ip::{
17 BanDuration, BanIpParams, BanIpWithMetadataParams, BannedIp, BannedIpRepository,
18};
19pub use device_cert::EnrollDeviceCertParams;
20pub use user::{MergeResult, UpdateUserParams};
21
22use crate::error::Result;
23use sqlx::PgPool;
24use std::sync::Arc;
25use systemprompt_database::DbPool;
26
27const MAX_PAGE_SIZE: i64 = 100;
28
29#[derive(Debug, Clone)]
30pub struct UserRepository {
31 pool: Arc<PgPool>,
32 write_pool: Arc<PgPool>,
33}
34
35impl UserRepository {
36 pub fn new(db: &DbPool) -> Result<Self> {
37 let pool = db.pool_arc()?;
38 let write_pool = db.write_pool_arc()?;
39 Ok(Self { pool, write_pool })
40 }
41}