mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-10 11:19:50 +08:00
Add multi-database data layer
Introduce aether-data-schema and driver-specific schema generation for Postgres, MySQL, and SQLite. Split data backends, lifecycle, repositories, and gateway runtime integration across database drivers. Verified with cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace.
This commit is contained in:
@@ -61,7 +61,7 @@ pub(in super::super) async fn build_admin_wallet_adjust_response(
|
||||
));
|
||||
}
|
||||
let operator_id = admin_wallet_operator_id(request_context);
|
||||
let has_postgres = state.has_postgres_pool();
|
||||
let has_wallet_writer = state.has_wallet_data_writer();
|
||||
let Some((wallet, transaction)) = state
|
||||
.admin_adjust_wallet_balance(
|
||||
&wallet_id,
|
||||
@@ -72,7 +72,7 @@ pub(in super::super) async fn build_admin_wallet_adjust_response(
|
||||
)
|
||||
.await?
|
||||
else {
|
||||
return if has_postgres {
|
||||
return if has_wallet_writer {
|
||||
Ok(build_admin_wallet_not_found_response())
|
||||
} else {
|
||||
Ok(build_admin_wallets_data_unavailable_response())
|
||||
|
||||
@@ -61,7 +61,7 @@ pub(in super::super) async fn build_admin_wallet_recharge_response(
|
||||
));
|
||||
}
|
||||
let operator_id = admin_wallet_operator_id(request_context);
|
||||
let has_postgres = state.has_postgres_pool();
|
||||
let has_wallet_writer = state.has_wallet_data_writer();
|
||||
let Some((wallet, payment_order)) = state
|
||||
.admin_create_manual_wallet_recharge(
|
||||
&wallet_id,
|
||||
@@ -72,7 +72,7 @@ pub(in super::super) async fn build_admin_wallet_recharge_response(
|
||||
)
|
||||
.await?
|
||||
else {
|
||||
return if has_postgres {
|
||||
return if has_wallet_writer {
|
||||
Ok(build_admin_wallet_not_found_response())
|
||||
} else {
|
||||
Ok(build_admin_wallets_data_unavailable_response())
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
use super::requests::ADMIN_WALLETS_API_KEY_GIFT_ADJUST_DETAIL;
|
||||
use crate::handlers::admin::request::AdminRequestContext;
|
||||
use crate::handlers::admin::shared::query_param_value;
|
||||
use crate::GatewayError;
|
||||
use sqlx::Row;
|
||||
|
||||
pub(in super::super) fn admin_wallet_operator_id(
|
||||
request_context: &AdminRequestContext<'_>,
|
||||
@@ -198,17 +196,6 @@ pub(in super::super) fn parse_admin_wallets_owner_type_filter(
|
||||
}
|
||||
}
|
||||
|
||||
pub(in super::super) fn optional_epoch_value(
|
||||
row: &sqlx::postgres::PgRow,
|
||||
key: &str,
|
||||
) -> Result<Option<String>, GatewayError> {
|
||||
Ok(row
|
||||
.try_get::<Option<i64>, _>(key)
|
||||
.map_err(|err| GatewayError::Internal(err.to_string()))?
|
||||
.and_then(|value| u64::try_from(value).ok())
|
||||
.and_then(crate::handlers::admin::shared::unix_secs_to_rfc3339))
|
||||
}
|
||||
|
||||
pub(in super::super) fn admin_wallet_build_order_no(now: chrono::DateTime<chrono::Utc>) -> String {
|
||||
format!(
|
||||
"po_{}_{}",
|
||||
|
||||
Reference in New Issue
Block a user