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 58285 additions and 54241 deletions
|
|
@ -1,48 +1,48 @@
|
|||
use axum::Json;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Path, State},
|
||||
};
|
||||
use pinakes_core::model::MediaId;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::dto::*;
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
|
||||
use pinakes_core::model::MediaId;
|
||||
use crate::{dto::*, error::ApiError, state::AppState};
|
||||
|
||||
pub async fn trigger_enrichment(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
// Submit enrichment as a background job
|
||||
let job_id = state
|
||||
.job_queue
|
||||
.submit(pinakes_core::jobs::JobKind::Enrich {
|
||||
media_ids: vec![MediaId(id)],
|
||||
})
|
||||
.await;
|
||||
Ok(Json(serde_json::json!({"job_id": job_id.to_string()})))
|
||||
// Submit enrichment as a background job
|
||||
let job_id = state
|
||||
.job_queue
|
||||
.submit(pinakes_core::jobs::JobKind::Enrich {
|
||||
media_ids: vec![MediaId(id)],
|
||||
})
|
||||
.await;
|
||||
Ok(Json(serde_json::json!({"job_id": job_id.to_string()})))
|
||||
}
|
||||
|
||||
pub async fn get_external_metadata(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<Json<Vec<ExternalMetadataResponse>>, ApiError> {
|
||||
let metadata = state.storage.get_external_metadata(MediaId(id)).await?;
|
||||
Ok(Json(
|
||||
metadata
|
||||
.into_iter()
|
||||
.map(ExternalMetadataResponse::from)
|
||||
.collect(),
|
||||
))
|
||||
let metadata = state.storage.get_external_metadata(MediaId(id)).await?;
|
||||
Ok(Json(
|
||||
metadata
|
||||
.into_iter()
|
||||
.map(ExternalMetadataResponse::from)
|
||||
.collect(),
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn batch_enrich(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<BatchDeleteRequest>, // Reuse: has media_ids field
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<BatchDeleteRequest>, // Reuse: has media_ids field
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
let media_ids: Vec<MediaId> = req.media_ids.into_iter().map(MediaId).collect();
|
||||
let job_id = state
|
||||
.job_queue
|
||||
.submit(pinakes_core::jobs::JobKind::Enrich { media_ids })
|
||||
.await;
|
||||
Ok(Json(serde_json::json!({"job_id": job_id.to_string()})))
|
||||
let media_ids: Vec<MediaId> =
|
||||
req.media_ids.into_iter().map(MediaId).collect();
|
||||
let job_id = state
|
||||
.job_queue
|
||||
.submit(pinakes_core::jobs::JobKind::Enrich { media_ids })
|
||||
.await;
|
||||
Ok(Json(serde_json::json!({"job_id": job_id.to_string()})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue