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:
@@ -47,7 +47,7 @@ fn ffmpeg_cmd() -> std::process::Command {
|
||||
cmd
|
||||
}
|
||||
|
||||
pub fn bbox_routes() -> Router<crate::api::server::AppState> {
|
||||
pub fn bbox_routes() -> Router<crate::api::types::AppState> {
|
||||
Router::new()
|
||||
.route(
|
||||
"/api/v1/file/:file_uuid/video/bbox",
|
||||
@@ -168,7 +168,7 @@ fn resolve_frame_range(
|
||||
}
|
||||
|
||||
async fn bbox_overlay_video(
|
||||
State(state): State<crate::api::server::AppState>,
|
||||
State(state): State<crate::api::types::AppState>,
|
||||
Path(file_uuid): Path<String>,
|
||||
Query(p): Query<BboxParams>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
@@ -297,7 +297,7 @@ fn parse_range(range: &str, file_size: u64) -> (u64, u64) {
|
||||
}
|
||||
|
||||
async fn trace_video(
|
||||
State(state): State<crate::api::server::AppState>,
|
||||
State(state): State<crate::api::types::AppState>,
|
||||
Path((file_uuid, trace_id)): Path<(String, i32)>,
|
||||
Query(params): Query<std::collections::HashMap<String, String>>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
@@ -554,7 +554,7 @@ async fn trace_video(
|
||||
}
|
||||
|
||||
async fn stream_video(
|
||||
State(state): State<crate::api::server::AppState>,
|
||||
State(state): State<crate::api::types::AppState>,
|
||||
Path(file_uuid): Path<String>,
|
||||
Query(params): Query<std::collections::HashMap<String, String>>,
|
||||
request: axum::http::Request<Body>,
|
||||
@@ -698,7 +698,7 @@ struct ThumbQuery {
|
||||
}
|
||||
|
||||
async fn face_thumbnail(
|
||||
State(state): State<crate::api::server::AppState>,
|
||||
State(state): State<crate::api::types::AppState>,
|
||||
Path(file_uuid): Path<String>,
|
||||
Query(q): Query<ThumbQuery>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
@@ -761,7 +761,7 @@ struct ClipQuery {
|
||||
}
|
||||
|
||||
async fn video_clip(
|
||||
State(state): State<crate::api::server::AppState>,
|
||||
State(state): State<crate::api::types::AppState>,
|
||||
Path(file_uuid): Path<String>,
|
||||
Query(q): Query<ClipQuery>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
|
||||
Reference in New Issue
Block a user