summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-24 22:23:53 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-24 22:23:53 -0700
commit580b579a3854ab070ac48680464a4413f552749c (patch)
tree47abdb9b1cccb4239cdb758259cc3e679a569c15 /rust
parent01a6c95f4efe357907681edc6ac6bd347017cf74 (diff)
downloadfatcat-580b579a3854ab070ac48680464a4413f552749c.tar.gz
fatcat-580b579a3854ab070ac48680464a4413f552749c.zip
end-to-end extra_json example
Diffstat (limited to 'rust')
-rw-r--r--rust/src/api_server.rs5
-rw-r--r--rust/src/database_models.rs2
-rw-r--r--rust/src/database_schema.rs3
3 files changed, 5 insertions, 5 deletions
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<serde_json::Value>,
+ pub extra_json: Option<serde_json::Value>,
pub editor_id: i64,
pub description: Option<String>,
}
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<Json>,
+ extra_json -> Nullable<Json>,
editor_id -> Int8,
description -> Nullable<Text>,
}
@@ -108,7 +108,6 @@ table! {
table! {
file_rev (id) {
id -> Int8,
- //extra_json -> Nullable<Json>,
size -> Nullable<Int8>,
sha1 -> Nullable<Text>,
url -> Nullable<Text>,