From 10441c957d3d1de24700bde475f1020818b818ec Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 18 Jan 2019 19:11:38 -0800 Subject: acutaly expand filesets/webcaptures --- rust/src/entity_crud.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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( -- cgit v1.2.3