Skip to content
Clone

feat(issues): add issue_stopwatch get handler

zhenyi committed
parent a6a6dee commit 9de5cb1 Browse files

1 file changed

+26 −0

Added lib/issues/handler/issue_stopwatch/get.rs View lib/issues/handler/issue_stopwatch/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::issue_stopwatch::StopwatchView;
9
10#[utoipa::path(
11 get,
12 path = "/issues/{channel_id}/{issue_id}/stopwatch",
13 tag = "issues",
14 responses((status = 200, description = "Get my stopwatch", body = StopwatchView)),
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)): Path<(Uuid, Uuid)>,
21) -> IssueResult<Json<StopwatchView>> {
22 let view = svc
23 .get_my_stopwatch(claims.sub, channel_id, issue_id)
24 .await?;
25 Ok(Json(view))
26}
No newline at end of file