Skip to content
Clone
2139a03
28 lines 894 B Rust
use axum::Json;
use axum::extract::{Path, State};
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::IssueResult;
use crate::features::IssueService;
use crate::features::comment::{CommentView, UpdateCommentOption};
#[utoipa::path(
patch,
path = "/issues/{channel_id}/{issue_id}/comments/{comment_id}",
tag = "issues",
request_body = UpdateCommentOption,
responses((status = 200, description = "Update comment", body = CommentView)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<IssueService>,
AuthUser { claims }: AuthUser,
Path((channel_id, issue_id, comment_id)): Path<(Uuid, Uuid, Uuid)>,
Json(input): Json<UpdateCommentOption>,
) -> IssueResult<Json<CommentView>> {
let view = svc
.update_comment(claims.sub, channel_id, issue_id, comment_id, input)
.await?;
Ok(Json(view))
}