refactor: modularize server.rs into separate route modules
- Extract scan.rs, files.rs, types.rs, processing.rs, visual_chunk_search.rs - Move AppState and AppConfig to types.rs - Each module exposes pub fn xxx_routes() -> Router<AppState> - server.rs reduced from 5005 to 118 lines (orchestrator only) - All stubs filled with real implementations from git history - Verify: cargo check, clippy, tests all pass
This commit is contained in:
@@ -98,7 +98,7 @@ pub enum SearchResult {
|
||||
},
|
||||
}
|
||||
|
||||
pub fn universal_search_routes() -> Router<crate::api::server::AppState> {
|
||||
pub fn universal_search_routes() -> Router<crate::api::types::AppState> {
|
||||
Router::new()
|
||||
.route("/api/v1/search/universal", post(universal_search))
|
||||
.route("/api/v1/search/frames", post(search_frames))
|
||||
@@ -106,7 +106,7 @@ pub fn universal_search_routes() -> Router<crate::api::server::AppState> {
|
||||
|
||||
/// Unified search across all data types
|
||||
pub async fn universal_search(
|
||||
State(_state): State<crate::api::server::AppState>,
|
||||
State(_state): State<crate::api::types::AppState>,
|
||||
Json(req): Json<UniversalSearchRequest>,
|
||||
) -> Result<Json<UniversalSearchResponse>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let start_time = std::time::Instant::now();
|
||||
@@ -212,7 +212,7 @@ pub async fn universal_search(
|
||||
|
||||
/// Search frames by YOLO objects, OCR text, or face IDs
|
||||
pub async fn search_frames(
|
||||
State(_state): State<crate::api::server::AppState>,
|
||||
State(_state): State<crate::api::types::AppState>,
|
||||
Json(req): Json<FrameSearchRequest>,
|
||||
) -> Result<Json<FrameSearchResponse>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let db = PostgresDb::init().await.map_err(|e| {
|
||||
@@ -238,7 +238,7 @@ pub async fn search_frames(
|
||||
|
||||
/// Search persons by name or speaker_id
|
||||
pub async fn search_persons(
|
||||
State(_state): State<crate::api::server::AppState>,
|
||||
State(_state): State<crate::api::types::AppState>,
|
||||
Query(query): Query<PersonSearchQuery>,
|
||||
) -> Result<Json<PersonSearchResponse>, (StatusCode, Json<serde_json::Value>)> {
|
||||
let db = PostgresDb::init().await.map_err(|e| {
|
||||
|
||||
Reference in New Issue
Block a user