fix: M4 Phase 1 bugs - dev.chunks refs, search_path, uuid column

Bug fixes from M4 report:
- 4 remaining dev.chunks → dev.chunk in SQL queries
- search_path includes public for pgvector extension
- get_chunk_by_chunk_id_and_uuid: uuid → file_uuid
- New endpoint: GET /api/v1/file/:uuid/chunk/:chunk_id
This commit is contained in:
Accusys
2026-05-11 10:21:06 +08:00
parent 39ba5ddf76
commit cac60c6093
17 changed files with 25156 additions and 8 deletions

View File

@@ -1306,6 +1306,25 @@ async fn trigger_processing(
})))
}
async fn get_chunk_by_path(
Path((file_uuid, chunk_id)): Path<(String, String)>,
State(state): State<AppState>,
) -> Result<Json<Chunk>, StatusCode> {
let chunk = state
.db
.get_chunk_by_chunk_id_and_uuid(&chunk_id, &file_uuid)
.await
.map_err(|_| {
tracing::error!("[get_chunk_by_path] DB error: {}:{}", file_uuid, chunk_id);
StatusCode::INTERNAL_SERVER_ERROR
})?
.ok_or_else(|| {
tracing::warn!("[get_chunk_by_path] Not found: {}:{}", file_uuid, chunk_id);
StatusCode::NOT_FOUND
})?;
Ok(Json(chunk))
}
async fn get_asset_status(
State(state): State<AppState>,
Path(uuid): Path<String>,
@@ -2508,6 +2527,7 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
.route("/api/v1/files/scan", get(scan_files))
.route("/api/v1/file/:file_uuid/probe", get(probe_by_uuid))
.route("/api/v1/file/:file_uuid/process", post(trigger_processing))
.route("/api/v1/file/:file_uuid/chunk/:chunk_id", get(get_chunk_by_path))
.route("/api/v1/progress/:uuid", get(get_progress))
.route("/api/v1/jobs", get(list_jobs))