use axum::Json; use axum::extract::{Path, Query, State}; use jwt::extractor::AuthUser; use uuid::Uuid; use crate::error::RepoResult; use crate::features::RepoService; use crate::features::git_ref::TreeView; #[derive(serde::Deserialize, utoipa::IntoParams)] pub struct TreeQuery { pub recursive: Option, } #[utoipa::path( get, path = "/repo/{channel_id}/{repo_id}/git/trees/{sha}", tag = "repo", params(TreeQuery), responses((status = 200, description = "Get a tree", body = TreeView)), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, sha)): Path<(Uuid, Uuid, String)>, Query(q): Query, ) -> RepoResult> { let view = svc .get_tree(claims.sub, repo_id, &sha, q.recursive.unwrap_or(false)) .await?; Ok(Json(view)) }