Skip to content
Clone
a06673b
28 lines 859 B Rust
use axum::Json;
use axum::extract::{Path, Query, State};
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::RepoResult;
use crate::features::RepoService;
use crate::features::collab::{CollaboratorPage, ListCollaboratorQuery};
#[utoipa::path(
get,
path = "/repo/{channel_id}/{repo_id}/collaborators",
tag = "repo",
params(ListCollaboratorQuery),
responses((status = 200, description = "List collaborators", body = CollaboratorPage)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id)): Path<(Uuid, Uuid)>,
Query(q): Query<ListCollaboratorQuery>,
) -> RepoResult<Json<CollaboratorPage>> {
let page = svc
.list_collaborators(claims.sub, repo_id, q.page, q.limit)
.await?;
Ok(Json(page))
}