Skip to content
Clone

feat(project): add links list handler

zhenyi committed
parent e81735d commit 1c61b6c Browse files

1 file changed

+24 −0

Added lib/project/handler/links/list.rs View lib/project/handler/links/list.rs
@@ -0,0 +1,24 @@
1use axum::extract::{Path, State};
2use export::data::AppResponseData;
3use jwt::extractor::AuthUser;
4
5use crate::error::ProjectResult;
6use crate::features::ProjectService;
7use crate::features::links::LinkPage;
8use crate::handler::query::ProjectPath;
9
10#[utoipa::path(
11 get,
12 path = "/spaces/{space_id}/projects/{project_id}/links",
13 tag = "project",
14 responses((status = 200, description = "List links", body = AppResponseData<LinkPage>)),
15 security(("bearer_auth" = []))
16)]
17pub(crate) async fn handler(
18 State(svc): State<ProjectService>,
19 AuthUser { claims }: AuthUser,
20 Path(path): Path<ProjectPath>,
21) -> ProjectResult<AppResponseData<LinkPage>> {
22 let page = svc.list_links(claims.sub, path.space_id, path.project_id).await?;
23 Ok(AppResponseData::ok(page))
24}
No newline at end of file