mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-01 09:40:28 +08:00
Add create_issue_comment_handler
This commit is contained in:
@@ -61,6 +61,7 @@ pub fn router(ctx: Context) -> Router {
|
||||
.route("/get_diff", post(diff_handler))
|
||||
.route("/list_issues", post(issues_handler))
|
||||
.route("/create_issue", post(create_issue_handler))
|
||||
.route("/create_issue_comment", post(create_issue_comment_handler))
|
||||
.route("/edit_issue", post(edit_issue_handler))
|
||||
.route("/issue_by_id", post(issue_handler))
|
||||
.route("/list_patches", post(patches_handler))
|
||||
@@ -172,6 +173,22 @@ async fn create_issue_handler(
|
||||
Ok::<_, Error>(Json(issues))
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct CreateIssueCommentBody {
|
||||
pub rid: identity::RepoId,
|
||||
pub new: types::cobs::thread::NewIssueComment,
|
||||
pub opts: types::cobs::CobOptions,
|
||||
}
|
||||
|
||||
async fn create_issue_comment_handler(
|
||||
State(ctx): State<Context>,
|
||||
Json(CreateIssueCommentBody { rid, opts, new }): Json<CreateIssueCommentBody>,
|
||||
) -> impl IntoResponse {
|
||||
let comment = ctx.create_issue_comment(rid, new, opts)?;
|
||||
|
||||
Ok::<_, Error>(Json(comment))
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct EditIssuesBody {
|
||||
|
||||
Reference in New Issue
Block a user