diff options
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( |