aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/api_server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 19:26:45 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 19:26:45 -0700
commite1b3c521341fcebaf5486e0af36ea15b14c40a4a (patch)
treeaeb061a5abee84fc9f4caa66fc7c139f8cc955f0 /rust/src/api_server.rs
parent024e9046ab646ea029a3421575255244118b0d55 (diff)
downloadfatcat-e1b3c521341fcebaf5486e0af36ea15b14c40a4a.tar.gz
fatcat-e1b3c521341fcebaf5486e0af36ea15b14c40a4a.zip
hack around JSON serialization for now
Diffstat (limited to 'rust/src/api_server.rs')
-rw-r--r--rust/src/api_server.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/rust/src/api_server.rs b/rust/src/api_server.rs
index 9fbcbc57..b8ec3abd 100644
--- a/rust/src/api_server.rs
+++ b/rust/src/api_server.rs
@@ -35,26 +35,40 @@ impl Api for Server {
) -> Box<Future<Item = ContainerIdGetResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
let id = uuid::Uuid::parse_str(&id).unwrap();
+ let (ident, rev): (ContainerIdentRow, Option<ContainerRevRow>) = container_ident::table
+ .find(id)
+ .left_outer_join(container_rev::table)
+ .first(&conn)
+ .expect("error loading container");
+/*
+ let (ident, rev): (ContainerIdentRow, Option<ContainerRevRow>) = container_ident::table
+ .left_join(container_rev::table)
+ .filter(container_ident::id.equals(id))
+ .first(&conn)
+ .expect("error loading container");
+*/
+/*
let c: ContainerIdentRow = container_ident::table
.find(id)
.first(&conn)
.expect("error loading container");
//let c: i64 = container_rev::table.count().first(&conn).expect("DB Error");
println!("container count: {:?}", c);
+*/
- let ce = ContainerEntity {
+ let entity = ContainerEntity {
issn: None,
publisher: Some("Hello!".into()),
parent: None,
name: None,
state: None,
- ident: Some(c.id.to_string()),
- revision: c.rev_id.map(|v| v as isize),
- redirect: None,
+ ident: Some(ident.id.to_string()),
+ revision: ident.rev_id.map(|v| v as isize),
+ redirect: ident.redirect_id.map(|u| u.to_string()),
editgroup: None,
};
Box::new(futures::done(Ok(
- ContainerIdGetResponse::FetchASingleContainerById(ce),
+ ContainerIdGetResponse::FetchASingleContainerById(entity),
)))
}