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::compare::CompareView; #[utoipa::path( get, path = "/repo/{channel_id}/{repo_id}/compare/{base}...{head}", tag = "repo", responses((status = 200, description = "Compare two refs", body = CompareView)), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, base_dot_head)): Path<(Uuid, Uuid, String)>, ) -> RepoResult> { let (base, head) = base_dot_head .split_once("...") .ok_or_else(|| crate::error::RepoError::BadRequest("expected '...'".into()))?; let view = svc.compare(claims.sub, repo_id, base, head).await?; Ok(Json(view)) }