From eae6f24cfb89f25a761a799aefb5e7a2389766df Mon Sep 17 00:00:00 2001 From: cd-rite <61710958+cd-rite@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:19:11 -0400 Subject: [PATCH] changed if/else to a ternary expression --- api/source/service/CollectionService.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/api/source/service/CollectionService.js b/api/source/service/CollectionService.js index b721564f..df819a5f 100644 --- a/api/source/service/CollectionService.js +++ b/api/source/service/CollectionService.js @@ -106,14 +106,8 @@ exports.queryCollections = async function (inProjection = [], inPredicates = {}, ) as "owners"`) } if (inProjection.includes('labels')) { - if ( inPredicates.collectionId ) { - // get labels for specified collectionId - queries.push(_this.getCollectionLabels(inPredicates.collectionId, userObject)) - } - else { - // no collectionId specified, get "all" labels - queries.push(_this.getCollectionLabels('all', userObject)) - } + // get labels for specified collectionId. If no collectionId specified, get "all" labels + queries.push(_this.getCollectionLabels(inPredicates.collectionId ? inPredicates.collectionId : 'all', userObject)); } if (inProjection.includes('statistics')) { if (context == dbUtils.CONTEXT_USER) {