aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/src/api_server.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 52e9501f..2a744525 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -626,14 +626,27 @@ impl Api for Server {
fn editgroup_post(
&self,
+ body: models::Editgroup,
context: &Context,
) -> Box<Future<Item = EditgroupPostResponse, Error = ApiError> + Send> {
- let context = context.clone();
- println!(
- "editgroup_post() - X-Span-ID: {:?}",
- context.x_span_id.unwrap_or(String::from("<none>")).clone()
- );
- Box::new(futures::failed("Generic failure".into()))
+ let conn = self.db_pool.get().expect("db_pool error");
+
+ let row: EditgroupRow = insert_into(editgroup::table)
+ .values((
+ editgroup::editor_id.eq(body.editor_id as i64),
+ editgroup::description.eq(body.description)
+ ))
+ .get_result(&conn)
+ .expect("error creating edit group");
+
+ let new_eg = Editgroup {
+ id: Some(row.id as isize),
+ editor_id: row.editor_id as isize,
+ description: row.description,
+ };
+ Box::new(futures::done(Ok(EditgroupPostResponse::SuccessfullyCreated(
+ new_eg,
+ ))))
}
fn editor_username_changelog_get(