Skip to content
Clone
a06673b
24 lines 687 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::lifecycle::RepoView;
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}",
tag = "repo",
responses((status = 200, description = "Get a repository", body = RepoView)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((channel_id, repo_id)): Path<(Uuid, Uuid)>,
) -> RepoResult<Json<RepoView>> {
let view = svc.get_repo(claims.sub, channel_id, repo_id).await?;
Ok(Json(view))
}