1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! Repository implementations for database access.
//!
//! This module provides repository structs for each major entity in the system.
//! Repositories follow a consistent pattern and implement the [`Repository`] trait.
//!
//! # Design Pattern
//!
//! Each repository:
//! - Wraps a SQLx connection or transaction
//! - Provides strongly-typed CRUD operations
//! - Handles query construction and parameter binding
//! - Returns domain models from [`crate::db::models`]
//! - Uses the connection's transaction for ACID guarantees
//!
//! # Available Repositories
//!
//! - [`Users`]: User account management and authentication
//! - [`Groups`]: Group definitions and user memberships
//! - [`Deployments`]: Model deployment configurations
//! - [`InferenceEndpoints`]: Backend inference endpoint management
//! - [`Credits`]: Credit balance tracking and transactions
//! - [`PasswordResetTokens`]: Password reset token lifecycle
//! - [`analytics`]: Request logging and analytics queries
//! - [`api_keys`]: API key management (not re-exported)
//!
//! # Common Pattern
//!
//! All repositories follow this usage pattern:
//!
//! ```ignore
//! use dwctl::db::handlers::{Users, Repository};
//!
//! async fn example(pool: &sqlx::PgPool) -> Result<(), Box<dyn std::error::Error>> {
//! // Start a transaction
//! let mut tx = pool.begin().await?;
//!
//! // Create repository from transaction
//! let mut repo = Users::new(&mut tx);
//!
//! // Perform operations
//! let users = repo.list(None, None).await?;
//!
//! // Commit or rollback
//! tx.commit().await?;
//! Ok(())
//! }
//! ```
//!
//! # The Repository Trait
//!
//! The [`Repository`] trait defines common CRUD operations that all repositories
//! should implement:
//!
//! - `new()`: Create a new repository instance
//! - `create()`: Insert a new record
//! - `get()`: Fetch a record by ID
//! - `list()`: List records with pagination
//! - `delete()`: Delete a record by ID
pub use BatchCapacityReservations;
pub use ;
pub use Credits;
pub use Deployments;
pub use Groups;
pub use InferenceEndpoints;
pub use Organizations;
pub use PasswordResetTokens;
pub use ProviderDisplayConfigs;
pub use Repository;
pub use Tariffs;
pub use ToolSources;
pub use Users;
pub use Webhooks;