d5939db
use axum::Json;
use axum::extract::{Path, State};
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::RepoResult;
use crate::features::git_ref::CommitView;
use crate::features::RepoService;
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}/git/commits/{sha}",
tag = "repo",
responses((status = 200, description = "Get a commit", body = CommitView)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id, sha)): Path<(Uuid, Uuid, String)>,
) -> RepoResult<Json<CommitView>> {
let view = svc.get_commit(claims.sub, repo_id, &sha).await?;
Ok(Json(view))
}