crates: production models and repo layer

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iceb76724c09eaca7ca5d823010db76776a6a6964
This commit is contained in:
raf 2025-11-02 23:33:33 +03:00
commit 1b12be3f8a
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
31 changed files with 3841 additions and 12 deletions

View file

@ -19,7 +19,10 @@ async fn test_database_connection() -> anyhow::Result<()> {
let db = match Database::new(config).await {
Ok(db) => db,
Err(e) => {
println!("Skipping test_database_connection: no PostgreSQL instance available - {}", e);
println!(
"Skipping test_database_connection: no PostgreSQL instance available - {}",
e
);
return Ok(());
}
};
@ -48,7 +51,10 @@ async fn test_database_health_check() -> anyhow::Result<()> {
let pool = match PgPool::connect("postgresql://postgres:password@localhost/test").await {
Ok(pool) => pool,
Err(e) => {
println!("Skipping test_database_health_check: no PostgreSQL instance available - {}", e);
println!(
"Skipping test_database_health_check: no PostgreSQL instance available - {}",
e
);
return Ok(());
}
};
@ -66,7 +72,10 @@ async fn test_connection_info() -> anyhow::Result<()> {
let pool = match PgPool::connect("postgresql://postgres:password@localhost/test").await {
Ok(pool) => pool,
Err(e) => {
println!("Skipping test_connection_info: no PostgreSQL instance available - {}", e);
println!(
"Skipping test_connection_info: no PostgreSQL instance available - {}",
e
);
return Ok(());
}
};
@ -79,10 +88,14 @@ async fn test_connection_info() -> anyhow::Result<()> {
idle_timeout: 600,
max_lifetime: 1800,
})
.await {
.await
{
Ok(db) => db,
Err(e) => {
println!("Skipping test_connection_info: database connection failed - {}", e);
println!(
"Skipping test_connection_info: database connection failed - {}",
e
);
pool.close().await;
return Ok(());
}
@ -111,10 +124,14 @@ async fn test_pool_stats() -> anyhow::Result<()> {
idle_timeout: 600,
max_lifetime: 1800,
})
.await {
.await
{
Ok(db) => db,
Err(e) => {
println!("Skipping test_pool_stats: no PostgreSQL instance available - {}", e);
println!(
"Skipping test_pool_stats: no PostgreSQL instance available - {}",
e
);
return Ok(());
}
};
@ -176,4 +193,3 @@ async fn test_database_config_validation() -> anyhow::Result<()> {
Ok(())
}