Skip to content

Commit

Permalink
Merge branch 'main' into qa
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Dec 16, 2024
2 parents 1b3e2bd + 9805396 commit 29373f2
Show file tree
Hide file tree
Showing 3 changed files with 1,618 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/jsonld_serializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ class ResourceSerializer extends JsonLdItemSerializer {
}

ResourceSerializer.getFormattedRecordType = function (recordTypeId) {
const prefLabel = recordTypes[recordTypeId]?.label
if (!prefLabel) return null
return {
'@id': recordTypeId,
prefLabel: recordTypes[recordTypeId].label
prefLabel
}
}

Expand Down Expand Up @@ -501,12 +503,16 @@ class AggregationSerializer extends JsonLdItemSerializer {
} else if (field === 'recordType') {
// Build recordType agg labels from nypl-core:
v.label = recordTypes[v.value]?.label
// Unknown recordType? Remove it:
if (!v.label) return null
} else {
v.label = v.value
}

return v
})
// Remove null aggregations (removed because found to be invalid)
.filter((agg) => agg)
} catch (e) { console.error(e) }

// Now that we've formatted buckets (into `values` prop), delete `buckets`
Expand Down
Loading

0 comments on commit 29373f2

Please sign in to comment.