use axum::Json; use axum::extract::{Path, State}; use export::rest::AppResponseData; use session::Session; use uuid::Uuid; use crate::errors::{ApiError, GitApiError}; use crate::handler::ensure_caller; use crate::service::GitService; use crate::service::repos::{CreateRepoCmd, RepoDto}; #[derive(Debug, Clone, serde::Deserialize)] pub struct SpacePath { pub space_name: String, } pub async fn create_repo( State(service): State, session: Session, Path(path): Path, Json(cmd): Json, ) -> Result, ApiError> { let caller: Uuid = ensure_caller(&session)?; let out = service .create_repo(path.space_name, caller, cmd) .await .map_err(GitApiError::from)?; Ok(AppResponseData::ok(out)) }