25 lines
533 B
Rust
25 lines
533 B
Rust
use axum::{
|
|
Json,
|
|
extract::{Path, State},
|
|
};
|
|
use serde::Deserialize;
|
|
use serde_json::{Value, json};
|
|
|
|
use crate::{error::ApiError, state::AppState};
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct WorkspacePath {
|
|
pub workspace_id: String,
|
|
}
|
|
|
|
pub async fn export_workspace(
|
|
Path(path): Path<WorkspacePath>,
|
|
State(state): State<AppState>,
|
|
) -> Result<Json<Value>, ApiError> {
|
|
let exported = state
|
|
.service
|
|
.export_workspace(&path.workspace_id.as_str().into())
|
|
.await?;
|
|
Ok(Json(json!(exported)))
|
|
}
|