From 552b7226dc86e76cbf9460b22b7de060ebc66af2 Mon Sep 17 00:00:00 2001 From: Vera Kahn Date: Thu, 5 Dec 2024 10:22:12 -0500 Subject: [PATCH] formatting --- .vscode/settings.json | 2 -- lib/jsonld_serializers.js | 1 + lib/response.js | 48 --------------------------------------- swagger.v1.1.x.json | 2 +- 4 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 lib/response.js diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 048eef5..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,2 +0,0 @@ -{"editor.defaultFormatter": "standard.vscode-standard", -"editor.formatOnSave": true} \ No newline at end of file diff --git a/lib/jsonld_serializers.js b/lib/jsonld_serializers.js index f184a9d..bc052cd 100644 --- a/lib/jsonld_serializers.js +++ b/lib/jsonld_serializers.js @@ -499,6 +499,7 @@ class AggregationSerializer extends JsonLdItemSerializer { // Build buildingLocation agg labels from nypl-core: v.label = locations[v.value]?.label } else if (field === 'recordType') { + console.log(v) // Build buildingLocation agg labels from nypl-core: v.label = recordTypes[v.value]?.label } else { diff --git a/lib/response.js b/lib/response.js deleted file mode 100644 index 5f4e9a0..0000000 --- a/lib/response.js +++ /dev/null @@ -1,48 +0,0 @@ -const { isAeonUrl, sortOnPropWithUndefinedLast } = require('../lib/util') - -class ElasticSearchResponse { - constructor (response, sortOnEnumerationChronology) { - this.response = response - this.sortOnEnumerationChronology = sortOnEnumerationChronology - } - - get _rawBibs () { - return this.response.hits?.hits?._source - } - - get bibs () { - const bibs = this._rawBibs.map(this.addItemsToBib) - - delete bibs.inner_hits - } - - addItemsToBib (hit) { - const bib = hit._source - bib.items = hit.inner_hits.items.hits.hits.map((itemHit) => itemHit._source) - if (this.sortOnEnumerationChronology) { - bib.items.sort(sortOnPropWithUndefinedLast('enumerationChronology_sort')) - } - bib.numItemsMatched = [hit.inner_hits.items.hits.total.value] - const unfilteredItems = (hit.inner_hits.allItems || hit.inner_hits.items) - bib.numItemsTotal = [unfilteredItems.hits.total.value] - return bib - } - - processElectronicResourceInnerHits (hit) { - if (hit?.inner_hits?.electronicResources) { - // If record doesn't have indexed electronicResources... - if (!hit._source.electronicResources || hit._source.electronicResources.length === 0) { - // Gather up all records in the electronicResources inner_hit, - // collect all of the electronicLocator values - // and save the resulting array to .electronicResources: - hit._source.electronicResources = hit.inner_hits.electronicResources.hits.hits - .map((resource) => resource._source.electronicLocator) - .reduce((acc, el) => acc.concat(el), []) - .filter((resource) => !isAeonUrl(resource.url)) - hit._source.numElectronicResources = [hit._source.electronicResources.length] - } - } - } -} - -module.exports = ElasticSearchResponse diff --git a/swagger.v1.1.x.json b/swagger.v1.1.x.json index 9d71c52..f8082ec 100644 --- a/swagger.v1.1.x.json +++ b/swagger.v1.1.x.json @@ -97,7 +97,7 @@ { "name": "filters[*]", "in": "query", - "description": "Specify a hash of filters to apply, where key is: 'recordType','buildingLocation', 'owner', 'subjectLiteral', 'holdingLocation', 'deliveryLocation', 'language', 'materialType', 'mediaType', 'carrierType', 'publisher', 'contributor', 'creator', 'issuance', 'createdYear', 'dateAfter', or 'dateBefore'", + "description": "Specify a hash of filters to apply, where key is: 'recordType', 'buildingLocation', 'owner', 'subjectLiteral', 'holdingLocation', 'deliveryLocation', 'language', 'materialType', 'mediaType', 'carrierType', 'publisher', 'contributor', 'creator', 'issuance', 'createdYear', 'dateAfter', or 'dateBefore'", "required": false, "type": "string" },