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::extras::{ReleaseAttachmentListResponse, ReleaseAttachmentView}; #[utoipa::path( get, path = "/repo/{channel_id}/{repo_id}/releases/{release_id}/assets", tag = "repo", responses((status = 200, description = "List release attachments", body = ReleaseAttachmentListResponse)), security(("bearer_auth" = [])) )] pub(crate) async fn list_handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, release_id)): Path<(Uuid, Uuid, Uuid)>, ) -> RepoResult> { let out = svc .list_release_attachments(claims.sub, repo_id, release_id) .await?; Ok(Json(out)) } #[utoipa::path( get, path = "/repo/{channel_id}/{repo_id}/releases/{release_id}/assets/{attachment_id}", tag = "repo", responses((status = 200, description = "Get a release attachment", body = ReleaseAttachmentView)), security(("bearer_auth" = [])) )] pub(crate) async fn get_handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, release_id, attachment_id)): Path<(Uuid, Uuid, Uuid, Uuid)>, ) -> RepoResult> { let out = svc .get_release_attachment(claims.sub, repo_id, release_id, attachment_id) .await?; Ok(Json(out)) }