Add missing readme_handler endpoint

This commit is contained in:
Sebastian Martinez
2025-07-16 09:41:47 +02:00
committed by Rūdolfs Ošiņš
parent e0ae5b5501
commit 8c3a629ecf
+15
View File
@@ -72,6 +72,7 @@ pub fn router(ctx: Context) -> Router {
"/activity_by_patch",
post(activity_patch_handler::<radicle::patch::Action, models::patch::Action>),
)
.route("/repo_readme", post(readme_handler))
.route("/repo_tree", post(tree_handler))
.route("/repo_blob", post(blob_handler))
.route("/get_diff", post(diff_handler))
@@ -172,6 +173,20 @@ struct DiffBody {
pub options: types::cobs::diff::DiffOptions,
}
#[derive(Serialize, Deserialize)]
struct ReadmeBody {
pub rid: identity::RepoId,
}
async fn readme_handler(
State(ctx): State<Context>,
Json(ReadmeBody { rid }): Json<ReadmeBody>,
) -> impl IntoResponse {
let readme = ctx.repo_readme(rid, None)?;
Ok::<_, Error>(Json(readme))
}
#[derive(Serialize, Deserialize)]
struct TreeBody {
pub rid: identity::RepoId,