chore: publish clean community baseline
Deploy / deploy (push) Successful in 2m44s
CI / Rust Checks (push) Successful in 5m31s
CI / UI Checks (push) Successful in 5s
CI / Deployment Manifests (push) Successful in 2s
CI / Frontend E2E (push) Successful in 4m24s

This commit is contained in:
github-ops
2026-06-17 06:15:46 +00:00
commit ba29ac7b94
320 changed files with 73936 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
use axum::{
Json,
extract::{Path, State},
};
use serde::Deserialize;
use serde_json::{Value, json};
use crate::{error::ApiError, service::UpstreamPayload, state::AppState};
#[derive(Deserialize)]
pub struct WorkspacePath {
pub workspace_id: String,
}
#[derive(Deserialize)]
pub struct WorkspaceUpstreamPath {
pub workspace_id: String,
pub upstream_id: String,
}
pub async fn list_upstreams(
Path(path): Path<WorkspacePath>,
State(state): State<AppState>,
) -> Result<Json<Value>, ApiError> {
let items = state
.service
.list_workspace_upstreams(&path.workspace_id.as_str().into())
.await?;
Ok(Json(json!({ "items": items })))
}
pub async fn create_upstream(
Path(path): Path<WorkspacePath>,
State(state): State<AppState>,
Json(payload): Json<UpstreamPayload>,
) -> Result<Json<Value>, ApiError> {
let upstream = state
.service
.save_workspace_upstream(&path.workspace_id.as_str().into(), None, payload)
.await?;
Ok(Json(json!(upstream)))
}
pub async fn update_upstream(
Path(path): Path<WorkspaceUpstreamPath>,
State(state): State<AppState>,
Json(payload): Json<UpstreamPayload>,
) -> Result<Json<Value>, ApiError> {
let upstream = state
.service
.save_workspace_upstream(
&path.workspace_id.as_str().into(),
Some(&path.upstream_id.as_str().into()),
payload,
)
.await?;
Ok(Json(json!(upstream)))
}