From 580b579a3854ab070ac48680464a4413f552749c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 May 2018 22:23:53 -0700 Subject: end-to-end extra_json example --- rust/src/api_server.rs | 5 +++-- rust/src/database_models.rs | 2 +- rust/src/database_schema.rs | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'rust') diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs index 5069d15d..7adf1a1d 100644 --- a/rust/src/api_server.rs +++ b/rust/src/api_server.rs @@ -351,7 +351,7 @@ impl Server { id: Some(row.id), editor_id: row.editor_id, description: row.description, - extra: None, + extra: row.extra_json, }; Ok(Some(eg)) } @@ -693,6 +693,7 @@ impl Api for Server { .values(( editgroup::editor_id.eq(body.editor_id as i64), editgroup::description.eq(body.description), + editgroup::extra_json.eq(body.extra), )) .get_result(&conn) .expect("error creating edit group"); @@ -701,7 +702,7 @@ impl Api for Server { id: Some(row.id), editor_id: row.editor_id, description: row.description, - extra: None, + extra: row.extra_json, }; Box::new(futures::done(Ok( EditgroupPostResponse::SuccessfullyCreated(new_eg), diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index 8e93d69e..d871d55d 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -181,7 +181,7 @@ pub struct FileReleaseRow { #[table_name = "editgroup"] pub struct EditgroupRow { pub id: i64, - //pub extra_json: Option, + pub extra_json: Option, pub editor_id: i64, pub description: Option, } diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs index a3b9cf2f..6856b19c 100644 --- a/rust/src/database_schema.rs +++ b/rust/src/database_schema.rs @@ -64,7 +64,7 @@ table! { table! { editgroup (id) { id -> Int8, - //extra_json -> Nullable, + extra_json -> Nullable, editor_id -> Int8, description -> Nullable, } @@ -108,7 +108,6 @@ table! { table! { file_rev (id) { id -> Int8, - //extra_json -> Nullable, size -> Nullable, sha1 -> Nullable, url -> Nullable, -- cgit v1.2.3