feat(issues): add issue_content_history list handler
zhenyi committed
Added lib/issues/handler/issue_content_history/list.rs lib/issues/handler/issue_content_history/list.rs +31 −0 View lib/issues/handler/issue_content_history/list.rs
@@ -0,0 +1,31 @@
1use axum::Json;
2use axum::extract::{Path, Query, State};
3use jwt::extractor::AuthUser;
4use uuid::Uuid;
5
6use crate::error::IssueResult;
7use crate::features::IssueService;
8use crate::features::issue_content_history::ListContentHistoryQuery;
9
10#[utoipa::path(
11 get,
12 path = "/issues/{channel_id}/{issue_id}/content_history",
13 tag = "issues",
14 params(ListContentHistoryQuery),
15 responses((status = 200, description = "List content history")),
16 security(("bearer_auth" = []))
17)]
18pub(crate) async fn handler(
19 State(svc): State<IssueService>,
20 AuthUser { claims }: AuthUser,
21 Path((channel_id, issue_id)): Path<(Uuid, Uuid)>,
22 Query(q): Query<ListContentHistoryQuery>,
23) -> IssueResult<Json<serde_json::Value>> {
24 let page = svc
25 .list_content_histories(claims.sub, channel_id, issue_id, q)
26 .await?;
27 Ok(Json(serde_json::json!({
28 "items": page.items,
29 "total": page.total,
30 })))
31}
No newline at end of file