Skip to content
Clone
a06673b
24 lines 698 B Rust
use axum::Json;
use axum::extract::{Path, State};
use jwt::extractor::AuthUser;
use uuid::Uuid;
use crate::error::RepoResult;
use crate::features::RepoService;
use crate::features::sync::SyncResult;
#[utoipa::path(
post,
path = "/repo/{channel_id}/{repo_id}/sync/run",
tag = "repo",
responses((status = 200, description = "Trigger a metadata sync", body = SyncResult)),
security(("bearer_auth" = []))
)]
pub(crate) async fn handler(
State(svc): State<RepoService>,
AuthUser { claims }: AuthUser,
Path((_, repo_id)): Path<(Uuid, Uuid)>,
) -> RepoResult<Json<SyncResult>> {
let result = svc.sync_repo_metadata(claims.sub, repo_id).await?;
Ok(Json(result))
}