a06673b
use axum::Json;
use axum::extract::{Path, State};
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::RepoResult;
use crate::features::RepoService;
use crate::features::git_ref::BlobView;
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}/git/blobs/{sha}",
tag = "repo",
responses((status = 200, description = "Get a blob", body = BlobView)),
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<BlobView>> {
let view = svc.get_blob(claims.sub, repo_id, &sha).await?;
Ok(Json(view))
}