aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-08-14 17:13:57 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-08-14 17:13:57 -0700
commit39921a6fdf47256b9c2fac67b876795fd0426464 (patch)
tree61c5368a5cfb363a2253d29957f9a9dcfec3835a /rust/src
parent2bfb6c54519c3442d663ea41d29f88fb31d96fb4 (diff)
downloadfatcat-39921a6fdf47256b9c2fac67b876795fd0426464.tar.gz
fatcat-39921a6fdf47256b9c2fac67b876795fd0426464.zip
trivial implementation of core_id field on releases
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/api_server.rs8
-rw-r--r--rust/src/database_models.rs1
-rw-r--r--rust/src/database_schema.rs1
3 files changed, 7 insertions, 3 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index e24b7e39..f7866b68 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -255,6 +255,7 @@ fn release_row2entity(
pmid: rev.pmid,
pmcid: rev.pmcid,
isbn13: rev.isbn13,
+ core_id: rev.core_id,
wikidata_qid: rev.wikidata_qid,
volume: rev.volume,
issue: rev.issue,
@@ -684,14 +685,14 @@ impl Server {
};
let edit: ReleaseEditRow = diesel::sql_query(
- "WITH rev AS ( INSERT INTO release_rev (title, release_type, release_status, release_date, doi, pmid, pmcid, wikidata_qid, isbn13, volume, issue, pages, work_ident_id, container_ident_id, publisher, language, extra_json)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)
+ "WITH rev AS ( INSERT INTO release_rev (title, release_type, release_status, release_date, doi, pmid, pmcid, wikidata_qid, isbn13, core_id, volume, issue, pages, work_ident_id, container_ident_id, publisher, language, extra_json)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
RETURNING id ),
ident AS ( INSERT INTO release_ident (rev_id)
VALUES ((SELECT rev.id FROM rev))
RETURNING id )
INSERT INTO release_edit (editgroup_id, ident_id, rev_id) VALUES
- ($18, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
+ ($19, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
).bind::<diesel::sql_types::Text, _>(entity.title)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.release_type)
@@ -703,6 +704,7 @@ impl Server {
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.pmcid)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.wikidata_qid)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.isbn13)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.core_id)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.volume)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.issue)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(entity.pages)
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs
index 50176f5f..258bcab7 100644
--- a/rust/src/database_models.rs
+++ b/rust/src/database_models.rs
@@ -177,6 +177,7 @@ pub struct ReleaseRevRow {
pub pmcid: Option<String>,
pub wikidata_qid: Option<String>,
pub isbn13: Option<String>,
+ pub core_id: Option<String>,
pub volume: Option<String>,
pub issue: Option<String>,
pub pages: Option<String>,
diff --git a/rust/src/database_schema.rs b/rust/src/database_schema.rs
index f935302a..3a8fe901 100644
--- a/rust/src/database_schema.rs
+++ b/rust/src/database_schema.rs
@@ -216,6 +216,7 @@ table! {
pmcid -> Nullable<Text>,
wikidata_qid -> Nullable<Text>,
isbn13 -> Nullable<Text>,
+ core_id -> Nullable<Text>,
volume -> Nullable<Text>,
issue -> Nullable<Text>,
pages -> Nullable<Text>,