feat(repository): add CRUD layer for all domain entities
- Add server/repository/ module with networks, hosts, ports, applications - Use sqlx::query() + manual row mapping (no compile-time DB required) - Handle unique-constraint conflicts with is_unique_violation() for cross-database compatibility (SQLite + PostgreSQL via AnyPool) - add_port_to_host auto-registers the port in the catalog (prevents FK errors) - application_ports has no FK to ports (intentional: loose association) - Add DbError::NotFound variant for missing-record cases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,9 @@ pub enum DbError {
|
||||
|
||||
#[error("Migration failed: {0}")]
|
||||
Migration(#[from] sqlx::migrate::MigrateError),
|
||||
|
||||
#[error("Record not found: {0}")]
|
||||
NotFound(String),
|
||||
}
|
||||
|
||||
// ─── Pool creation ────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user