Skip to content
Clone

feat(issues): add comment get handler

zhenyi committed
parent 1cc89ec commit 1f83a06 Browse files

1 file changed

+26 −0

Added lib/issues/handler/comment/get.rs View lib/issues/handler/comment/get.rs
@@ -0,0 +1,26 @@
1use axum::Json;
2use axum::extract::{Path, State};
3use jwt::extractor::AuthUser;
4use uuid::Uuid;
5
6use crate::error::IssueResult;
7use crate::features::IssueService;
8use crate::features::comment::CommentView;
9
10#[utoipa::path(
11 get,
12 path = "/issues/{channel_id}/{issue_id}/comments/{comment_id}",
13 tag = "issues",
14 responses((status = 200, description = "Get comment", body = CommentView)),
15 security(("bearer_auth" = []))
16)]
17pub(crate) async fn handler(
18 State(svc): State<IssueService>,
19 AuthUser { claims }: AuthUser,
20 Path((channel_id, issue_id, comment_id)): Path<(Uuid, Uuid, Uuid)>,
21) -> IssueResult<Json<CommentView>> {
22 let view = svc
23 .get_comment(claims.sub, channel_id, issue_id, comment_id)
24 .await?;
25 Ok(Json(view))
26}
No newline at end of file