refactor(api): split Axum handlers into handler/service/repo modules

Keep the REST contract; move domain logic out of route files so checkout, fulfillment, and identity can be reused across customer, shop, and admin surfaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-09-18 14:59:36 +08:00
co-authored by Cursor
parent e457339847
commit 5e866d08f4
68 changed files with 3796 additions and 2304 deletions
+6 -5
View File
@@ -9,11 +9,12 @@ pub struct AppState {
pub async fn build_state(config: &crate::config::Config) -> anyhow::Result<AppState> {
let db = PgPool::connect(&config.database_url).await?;
assemble(config.clone(), db).await
}
/// Build state from an already-open pool (migrate + serve share one pool).
pub async fn assemble(config: crate::config::Config, db: PgPool) -> anyhow::Result<AppState> {
let client = redis::Client::open(config.redis_url.clone())?;
let redis = redis::aio::ConnectionManager::new(client).await?;
Ok(AppState {
db,
redis,
config: config.clone(),
})
Ok(AppState { db, redis, config })
}