From a1c457661f3ba528470922eda4383cc544d105c0 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 21 Dec 2018 15:37:56 -0800 Subject: allow expand creators in release gets --- fatcat-openapi2.yml | 2 +- rust/src/api_entity_crud.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fatcat-openapi2.yml b/fatcat-openapi2.yml index a30bb55e..1022e6d3 100644 --- a/fatcat-openapi2.yml +++ b/fatcat-openapi2.yml @@ -1267,7 +1267,7 @@ paths: in: query type: string required: false - description: "List of sub-entities to expand in response. For releases, 'files' and 'container' are valid." + description: "List of sub-entities to expand in response. For releases, 'files', 'container', and 'creators' are valid." - name: hide in: query type: string diff --git a/rust/src/api_entity_crud.rs b/rust/src/api_entity_crud.rs index cf17a329..eb7a3ac9 100644 --- a/rust/src/api_entity_crud.rs +++ b/rust/src/api_entity_crud.rs @@ -1030,6 +1030,18 @@ impl EntityCrud for ReleaseEntity { )?); } } + if expand.creators { + if let Some(ref mut contribs) = self.contribs { + for contrib in contribs { + if let Some(ref creator_id) = contrib.creator_id { + contrib.creator = Some(CreatorEntity::db_get( + conn, + FatCatId::from_str(creator_id)?, + HideFlags::none())?); + } + } + } + } Ok(()) } -- cgit v1.2.3