style: format wallet fallback reporting and postgres test

This commit is contained in:
elky
2026-10-09 22:17:22 +08:00
parent 6b6d5b3a85
commit 29ba6c8cb1
3 changed files with 12 additions and 8 deletions
+3 -4
View File
@@ -11,8 +11,7 @@ pub(crate) use aether_usage_runtime::{
};
pub(crate) use aether_usage_runtime::{UsageQueueHealthSnapshot, UsageRuntimeMetricsSnapshot};
pub(crate) use reporting::{
attach_plan_wallet_fallback_context,
attach_internal_gateway_report_capability, resolve_bound_internal_gateway_report_context,
spawn_sync_report, submit_stream_report, submit_sync_report, GatewayStreamReportRequest,
GatewaySyncReportRequest,
attach_internal_gateway_report_capability, attach_plan_wallet_fallback_context,
resolve_bound_internal_gateway_report_context, spawn_sync_report, submit_stream_report,
submit_sync_report, GatewayStreamReportRequest, GatewaySyncReportRequest,
};
@@ -15,8 +15,8 @@ use crate::{AppState, GatewayError};
mod context;
pub(crate) mod failure;
pub(crate) use context::{
attach_plan_wallet_fallback_context,
attach_internal_gateway_report_capability, resolve_bound_internal_gateway_report_context,
attach_internal_gateway_report_capability, attach_plan_wallet_fallback_context,
resolve_bound_internal_gateway_report_context,
};
use context::{report_context_is_locally_actionable, resolve_locally_actionable_report_context};
@@ -665,8 +665,13 @@ async fn live_overview_settlement_allocations_preserve_unlimited_and_finite_wall
_ => 0.0,
};
if quota > 0.0 {
sqlx::query("INSERT INTO user_preferences(id,user_id,allow_wallet_overage) VALUES($1,$1,true)")
.bind(&user).execute(&pool).await.unwrap();
sqlx::query(
"INSERT INTO user_preferences(id,user_id,allow_wallet_overage) VALUES($1,$1,true)",
)
.bind(&user)
.execute(&pool)
.await
.unwrap();
let grant = serde_json::json!([{"type":"daily_quota","daily_quota_usd":quota,"reset_timezone":"UTC","allow_wallet_overage":true}]);
sqlx::query("INSERT INTO billing_plans(id,title,price_amount,duration_unit,duration_value,entitlements_json,created_at,updated_at) VALUES($1,'test',1,'month',1,$2,NOW(),NOW())").bind(&user).bind(&grant).execute(&pool).await.unwrap();
sqlx::query("INSERT INTO payment_orders(id,order_no,wallet_id,user_id,amount_usd,payment_method,created_at) VALUES($1,$1,$2,$1,1,'test',NOW())").bind(&user).bind(&wallet).execute(&pool).await.unwrap();