treewide: fix various UI bugs; optimize crypto dependencies & format
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
This commit is contained in:
parent
764aafa88d
commit
3ccddce7fd
178 changed files with 58342 additions and 54241 deletions
|
|
@ -1,30 +1,29 @@
|
|||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use axum::{Json, extract::State};
|
||||
|
||||
use crate::dto::*;
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
use crate::{dto::*, error::ApiError, state::AppState};
|
||||
|
||||
/// Trigger a scan as a background job. Returns the job ID immediately.
|
||||
pub async fn trigger_scan(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<ScanRequest>,
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<ScanRequest>,
|
||||
) -> Result<Json<ScanJobResponse>, ApiError> {
|
||||
let kind = pinakes_core::jobs::JobKind::Scan { path: req.path };
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(ScanJobResponse {
|
||||
job_id: job_id.to_string(),
|
||||
}))
|
||||
let kind = pinakes_core::jobs::JobKind::Scan { path: req.path };
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(ScanJobResponse {
|
||||
job_id: job_id.to_string(),
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn scan_status(State(state): State<AppState>) -> Json<ScanStatusResponse> {
|
||||
let snapshot = state.scan_progress.snapshot();
|
||||
let error_count = snapshot.errors.len();
|
||||
Json(ScanStatusResponse {
|
||||
scanning: snapshot.scanning,
|
||||
files_found: snapshot.files_found,
|
||||
files_processed: snapshot.files_processed,
|
||||
error_count,
|
||||
errors: snapshot.errors,
|
||||
})
|
||||
pub async fn scan_status(
|
||||
State(state): State<AppState>,
|
||||
) -> Json<ScanStatusResponse> {
|
||||
let snapshot = state.scan_progress.snapshot();
|
||||
let error_count = snapshot.errors.len();
|
||||
Json(ScanStatusResponse {
|
||||
scanning: snapshot.scanning,
|
||||
files_found: snapshot.files_found,
|
||||
files_processed: snapshot.files_processed,
|
||||
error_count,
|
||||
errors: snapshot.errors,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue