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,42 +1,42 @@
|
|||
use axum::Json;
|
||||
use axum::extract::State;
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::error::ApiError;
|
||||
use crate::state::AppState;
|
||||
use axum::{Json, extract::State};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{error::ApiError, state::AppState};
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ExportRequest {
|
||||
pub format: String,
|
||||
pub destination: PathBuf,
|
||||
pub format: String,
|
||||
pub destination: PathBuf,
|
||||
}
|
||||
|
||||
pub async fn trigger_export(
|
||||
State(state): State<AppState>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
// Default export to JSON in data dir
|
||||
let dest = pinakes_core::config::Config::default_data_dir().join("export.json");
|
||||
let kind = pinakes_core::jobs::JobKind::Export {
|
||||
format: pinakes_core::jobs::ExportFormat::Json,
|
||||
destination: dest,
|
||||
};
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(serde_json::json!({ "job_id": job_id.to_string() })))
|
||||
// Default export to JSON in data dir
|
||||
let dest =
|
||||
pinakes_core::config::Config::default_data_dir().join("export.json");
|
||||
let kind = pinakes_core::jobs::JobKind::Export {
|
||||
format: pinakes_core::jobs::ExportFormat::Json,
|
||||
destination: dest,
|
||||
};
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(serde_json::json!({ "job_id": job_id.to_string() })))
|
||||
}
|
||||
|
||||
pub async fn trigger_export_with_options(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<ExportRequest>,
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<ExportRequest>,
|
||||
) -> Result<Json<serde_json::Value>, ApiError> {
|
||||
let format = match req.format.as_str() {
|
||||
"csv" => pinakes_core::jobs::ExportFormat::Csv,
|
||||
_ => pinakes_core::jobs::ExportFormat::Json,
|
||||
};
|
||||
let kind = pinakes_core::jobs::JobKind::Export {
|
||||
format,
|
||||
destination: req.destination,
|
||||
};
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(serde_json::json!({ "job_id": job_id.to_string() })))
|
||||
let format = match req.format.as_str() {
|
||||
"csv" => pinakes_core::jobs::ExportFormat::Csv,
|
||||
_ => pinakes_core::jobs::ExportFormat::Json,
|
||||
};
|
||||
let kind = pinakes_core::jobs::JobKind::Export {
|
||||
format,
|
||||
destination: req.destination,
|
||||
};
|
||||
let job_id = state.job_queue.submit(kind).await;
|
||||
Ok(Json(serde_json::json!({ "job_id": job_id.to_string() })))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue