diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-18 19:11:38 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-18 19:11:38 -0800 |
commit | 10441c957d3d1de24700bde475f1020818b818ec (patch) | |
tree | 82b5921313bf044d7653c5edb9ddca405227ef57 /rust | |
parent | b17277cd793df7bf916b20ec576e3e6301c8cfe4 (diff) | |
download | fatcat-10441c957d3d1de24700bde475f1020818b818ec.tar.gz fatcat-10441c957d3d1de24700bde475f1020818b818ec.zip |
acutaly expand filesets/webcaptures
Diffstat (limited to 'rust')
-rw-r--r-- | rust/src/entity_crud.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs index a7186f38..f5c092eb 100644 --- a/rust/src/entity_crud.rs +++ b/rust/src/entity_crud.rs @@ -8,7 +8,7 @@ use crate::database_models::*; use crate::database_schema::*; use crate::editing::EditContext; -use crate::endpoint_handlers::get_release_files; +use crate::endpoint_handlers::{get_release_files, get_release_filesets, get_release_webcaptures}; use crate::errors::*; use crate::identifiers::*; use crate::server::DbConn; @@ -1675,6 +1675,26 @@ impl EntityCrud for ReleaseEntity { }; self.files = Some(get_release_files(conn, ident, HideFlags::none())?); } + if expand.filesets && self.ident.is_some() { + let ident = match &self.ident { + None => bail!("Can't expand filesets on a non-concrete entity"), // redundant with above is_some() + Some(ident) => match &self.redirect { + None => FatcatId::from_str(&ident)?, + Some(redir) => FatcatId::from_str(&redir)?, + }, + }; + self.filesets = Some(get_release_filesets(conn, ident, HideFlags::none())?); + } + if expand.webcaptures && self.ident.is_some() { + let ident = match &self.ident { + None => bail!("Can't expand webcaptures on a non-concrete entity"), // redundant with above is_some() + Some(ident) => match &self.redirect { + None => FatcatId::from_str(&ident)?, + Some(redir) => FatcatId::from_str(&redir)?, + }, + }; + self.webcaptures = Some(get_release_webcaptures(conn, ident, HideFlags::none())?); + } if expand.container { if let Some(ref cid) = self.container_id { self.container = Some(ContainerEntity::db_get( |