From e1b3c521341fcebaf5486e0af36ea15b14c40a4a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 15 May 2018 19:26:45 -0700 Subject: hack around JSON serialization for now --- rust/src/api_server.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'rust/src/api_server.rs') 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 + Send> { let conn = self.db_pool.get().expect("db_pool error"); let id = uuid::Uuid::parse_str(&id).unwrap(); + let (ident, rev): (ContainerIdentRow, Option) = container_ident::table + .find(id) + .left_outer_join(container_rev::table) + .first(&conn) + .expect("error loading container"); +/* + let (ident, rev): (ContainerIdentRow, Option) = 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), ))) } -- cgit v1.2.3