2ae9196
ZhenYi
feat(lib/git): add HTTP handler tree with routes and errors across analysis, archives, blobs, branches, commits, conflicts, content, diffs, hooks, lfs, logs, maintenance, packs, patches, pipelines, refs, remotes, repos, signatures, submodules, tags, trees
2ae9196
use axum::extract::{Path, State};
use export::rest::AppResponseData;
use session::Session;
use crate::errors::{ApiError, GitApiError};
use crate::handler::resolve_reader;
use crate::service::GitService;
use crate::service::signatures::VerifyResultDto;
#[derive(Debug, Clone, serde::Deserialize)]
pub struct CommitShaPath {
pub space_name: String,
pub repo_name: String,
pub sha: String,
}
pub async fn verify_commit(
State(service): State<GitService>,
session: Session,
Path(path): Path<CommitShaPath>,
) -> Result<AppResponseData<VerifyResultDto>, ApiError> {
let _ = resolve_reader(&service, &session, path.space_name.clone(), path.repo_name.clone()).await?;
let out = service
.signature_verify_commit(path.space_name, path.repo_name, path.sha)
.await
.map_err(GitApiError::from)?;
Ok(AppResponseData::ok(out))
}