Skip to content
Clone
a06673b
24 lines 711 B Rust
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::branch::BranchView;
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}/branches/{branch_name}",
tag = "repo",
responses((status = 200, description = "Get a branch", body = BranchView)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id, name)): Path<(Uuid, Uuid, String)>,
) -> RepoResult<Json<BranchView>> {
let view = svc.get_branch(claims.sub, repo_id, &name).await?;
Ok(Json(view))
}