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::deploy_key::DeployKeyView;
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}/keys/{key_id}",
tag = "repo",
responses((status = 200, description = "Get a deploy key", body = DeployKeyView)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id, key_id)): Path<(Uuid, Uuid, Uuid)>,
) -> RepoResult<Json<DeployKeyView>> {
let view = svc.get_deploy_key(claims.sub, repo_id, key_id).await?;
Ok(Json(view))
}