summaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-24 22:50:18 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-24 22:50:18 -0700
commitaf61dbc1ca2c4babbe96d1b924f799d8a5859255 (patch)
tree0402e4329dd2a974ad85ad45fde9031e2da682eb /rust
parent0133a3eda3726cc185f6adfdbc995e0f33d55fa5 (diff)
downloadfatcat-af61dbc1ca2c4babbe96d1b924f799d8a5859255.tar.gz
fatcat-af61dbc1ca2c4babbe96d1b924f799d8a5859255.zip
include container_id relation
Diffstat (limited to 'rust')
-rw-r--r--rust/src/api_server.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 9a2f3b56..8364ec8c 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -303,7 +303,7 @@ impl Server {
volume: rev.volume,
pages: rev.pages,
issue: rev.issue,
- container_id: None, // TODO
+ container_id: rev.container_ident_id.map(|u| u.to_string()),
work_id: rev.work_ident_id.to_string(),
state: Some(ident.state().unwrap().shortname()),
ident: Some(ident.id.to_string()),
@@ -339,7 +339,7 @@ impl Server {
volume: rev.volume,
pages: rev.pages,
issue: rev.issue,
- container_id: None, // TODO
+ container_id: rev.container_ident_id.map(|u| u.to_string()),
work_id: rev.work_ident_id.to_string(),
state: Some(ident.state().unwrap().shortname()),
ident: Some(ident.id.to_string()),
@@ -639,30 +639,30 @@ impl Api for Server {
};
let work_id = uuid::Uuid::parse_str(&body.work_id).expect("invalid UUID");
- let _container_id: Option<uuid::Uuid> = match body.container_id {
+ let container_id: Option<uuid::Uuid> = match body.container_id {
Some(id) => Some(uuid::Uuid::parse_str(&id).expect("invalid UUID")),
None => None,
};
let edit: ReleaseEditRow = diesel::sql_query(
- "WITH rev AS ( INSERT INTO release_rev (title, release_type, doi, volume, pages, issue, work_ident_id)
- VALUES ($1, $2, $3, $4, $5, $6, $7)
+ "WITH rev AS ( INSERT INTO release_rev (title, release_type, doi, volume, pages, issue, work_ident_id, container_ident_id)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
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
- ($8, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
+ ($9, (SELECT ident.id FROM ident), (SELECT rev.id FROM rev))
RETURNING *",
).bind::<diesel::sql_types::Text, _>(body.title)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.release_type)
- //.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.date)
+ //XXX .bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.date)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.doi)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.volume)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.pages)
.bind::<diesel::sql_types::Nullable<diesel::sql_types::Text>, _>(body.issue)
.bind::<diesel::sql_types::Uuid, _>(work_id)
- //.bind::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, _>(body.container_id)
+ .bind::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, _>(container_id)
.bind::<diesel::sql_types::BigInt, _>(editgroup_id)
.get_result(&conn)
.unwrap();