use axum::Json; use axum::extract::{Path, State}; use axum::http::StatusCode; use jwt::extractor::AuthUser; use uuid::Uuid; use crate::error::RepoResult; use crate::features::RepoService; use crate::features::contents::{ContentsResponse, CreateFileOption}; #[utoipa::path( post, path = "/repo/{channel_id}/{repo_id}/contents/{path}", tag = "repo", request_body = CreateFileOption, responses((status = 201, description = "Create a file", body = ContentsResponse)), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, path)): Path<(Uuid, Uuid, String)>, Json(input): Json, ) -> RepoResult<(StatusCode, Json)> { let resp = svc.create_file(claims.sub, repo_id, &path, input).await?; Ok((StatusCode::CREATED, Json(resp))) }