feat(issues): add issue_stopwatch stop handler
zhenyi committed
Added lib/issues/handler/issue_stopwatch/stop.rs lib/issues/handler/issue_stopwatch/stop.rs +23 −0 View lib/issues/handler/issue_stopwatch/stop.rs
@@ -0,0 +1,23 @@
1use axum::extract::{Path, State};
2use axum::http::StatusCode;
3use jwt::extractor::AuthUser;
4use uuid::Uuid;
5
6use crate::error::IssueResult;
7use crate::features::IssueService;
8
9#[utoipa::path(
10 delete,
11 path = "/issues/{channel_id}/{issue_id}/stopwatch",
12 tag = "issues",
13 responses((status = 204, description = "Stop stopwatch")),
14 security(("bearer_auth" = []))
15)]
16pub(crate) async fn handler(
17 State(svc): State<IssueService>,
18 AuthUser { claims }: AuthUser,
19 Path((channel_id, issue_id)): Path<(Uuid, Uuid)>,
20) -> IssueResult<StatusCode> {
21 svc.stop_watch(claims.sub, channel_id, issue_id).await?;
22 Ok(StatusCode::NO_CONTENT)
23}
No newline at end of file