config: add revision reads and conflict recovery

This commit is contained in:
2026-08-14 01:41:23 +09:00
parent 544abbbf56
commit 348ac51011
6 changed files with 197 additions and 11 deletions
+22
View File
@@ -1151,6 +1151,10 @@ pub fn build_router(api: WorkspaceApi) -> Router {
"/api/w/{workspace_id}/config/source-tree/commit",
post(scoped_commit_workspace_config_tree),
)
.route(
"/api/w/{workspace_id}/config/source-tree/revisions/{revision}",
get(scoped_get_workspace_config_revision),
)
.route(
"/api/w/{workspace_id}/config/source-tree/entries/{*path}",
get(scoped_get_workspace_config_entry),
@@ -2441,6 +2445,24 @@ async fn scoped_update_workspace_settings(
))
}
#[derive(Debug, Deserialize)]
struct WorkspaceConfigRevisionPath {
workspace_id: String,
revision: u64,
}
async fn scoped_get_workspace_config_revision(
State(api): State<WorkspaceApi>,
AxumPath(path): AxumPath<WorkspaceConfigRevisionPath>,
) -> ApiResult<Json<ConfigTreeSnapshot>> {
validate_workspace_scope(&api, &path.workspace_id)?;
let snapshot = api
.config_store
.load_workspace_config_revision(&path.workspace_id, path.revision)?
.ok_or_else(|| ApiError::from(Error::InvalidRecordId(path.revision.to_string())))?;
Ok(Json(snapshot))
}
#[derive(Debug, Deserialize)]
struct WorkspaceConfigEntryPath {
workspace_id: String,