use axum::extract::{Path, Query, State}; use export::rest::AppResponseData; use session::Session; use crate::errors::{ApiError, GitApiError}; use crate::handler::resolve_reader; use crate::service::GitService; use crate::service::trees::PathLastUpdated; #[derive(Debug, Clone, serde::Deserialize, utoipa::IntoParams)] pub struct TreeLastUpdatedQuery { pub revision: String, #[serde(default)] pub path: Option, } #[utoipa::path( get, path = "/repos/{space_name}/{repo_name}/tree/last-updated", tag = "trees", params( crate::handler::RepoPath, TreeLastUpdatedQuery, ), responses( (status = 200, description = "last updated tree entries", body = AppResponseData>) ) )] pub async fn tree_last_updated( State(service): State, session: Session, Path(path): Path, Query(q): Query, ) -> Result>, ApiError> { let _ = resolve_reader( &service, &session, path.space_name.clone(), path.repo_name.clone(), ) .await?; let out = service .tree_last_updated(path.space_name, path.repo_name, q.revision, q.path) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }