GQL-118: Add support for retrieving a collection revision#182
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #182 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 115 115
Lines 2706 2719 +13
Branches 330 335 +5
=========================================
+ Hits 2706 2719 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
macrouch
left a comment
There was a problem hiding this comment.
I'm confused about how we are handling json fields. In my testing I tried added boxes to my request and I just got null, but when I add the revisions field I get a CMR error. We had talked during one iteration of this ticket that we could let users know fields weren't supported. Did we want to do that or are we just returning null?
It also seems like the revisions field is broken. Even without including the revisionId parameter I still get back a CMR error when requesting the revisions field ("The mime type [application/json] is not supported when all_revisions = true.") which could be confusing for a user
|
Did some integration testing on this against my local MMT hooked to SIT while this was up. Obviously that is its own effort but, in principle we can use this API to fix that issue in MMT |
Overview
What is the feature?
This feature adds support for fetching specific revisions of collections in the GraphQL API. It allows querying a particular historical revision of a collection by its concept ID and revision ID.
What is the Solution?
Route all queries for revisions exclusively through the UMM endpoint, which does support historical revisions.
Key changes include:
src/cmr/concepts/concept.js:
Added support for revisionId in the fetchUmm method.
Modified the parseUmm method to filter out items that don't match the requested revisionId.
Added logic to update the item count when filtering by revisionId.
src/resolvers/tests/collection.test.js:
Added new tests for retrieving collections by revisionId.
Included tests for both successful retrieval and cases where the specified revision doesn't exist.
src/types/collection.graphql:
Added revisionId as a new input parameter in the CollectionInput type.
src/utils/tests/parseRequestedFields.test.js:
Added a new test case for when revisionId is provided, ensuring all keys are moved to ummKeys.
src/utils/cmrQuery.js:
Modified to support the all_revisions parameter when options.allRevisions is set.
src/utils/parseRequestedFields.js:
Updated to handle the revisionId parameter.
Modified logic to use UMM endpoint exclusively when revisionId is present.
src/utils/umm/collectionKeyMap.json:
Added 'provider' to the list of shared keys.
Mapped 'provider' to 'meta.provider-id' in the UMM key mappings.
What areas of the application does this impact?
Query for single collection: revisionId added as new parameter to CollectionInput
Testing
Reproduction steps
Checklist