Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDFHER-83 - implement new holdings endpoint /external/agencyid/catalog/holdingsLogistics/v1 #1443

Closed

Conversation

kasperbirch1
Copy link
Contributor

@kasperbirch1 kasperbirch1 commented Sep 20, 2024

Link to issue

https://reload.atlassian.net/browse/DDFHER-83
https://ciceroconnect.zendesk.com/hc/da/article_attachments/16168497399324

Description

This pull request replaces /external/agencyid/catalog/holdings/v3 with /external/agencyid/catalog/holdingsLogistics/v1.

The new endpoint, holdingsLogistics/v1, provides more precise information about the location of materials, which is particularly important for the FindOnShelf modal.

Although most of the work involved writing our own OpenAPI specification, there are very few code changes. The key API change is that we now use location, sublocation, department, and section under the new lmsPlacement key.

The most significant work was in updating fixtures. I’ve made an effort to refresh the data used in the fixtures and correct any issues in the tests. However, this was not possible for all tests, as some require specific circumstances and were therefore edited or fully manual.

This work highlights the ongoing challenge we face with maintaining manual specifications and fixtures.

Test

https://varnish.pr-1761.dpl-cms.dplplat01.dpl.reload.dk/

@kasperbirch1 kasperbirch1 marked this pull request as draft October 1, 2024 07:02
This is necessary because some of the libraries use that system instead of `/external/agencyid/catalog/holdings/v3`.

https://reload.atlassian.net/browse/DDFHER-83
We now exclusively use `external/agencyid/catalog/holdingsLogistics/v1`. This API provides more precise information regarding the location of the materials.
- Replaced `HoldingsV3` with `HoldingsLogisticsV1`
- Replaced `HoldingsForBibliographicalRecordV3` with `HoldingsForBibliographicalRecordLogisticsV1`
- Replaced `getGetHoldingsV3QueryKey` with `getGetExternalAgencyidCatalogHoldingsLogisticsV1QueryKey`

Refactors:
- In `FindOnShelfManifestationListItem`, the values for `department`, `location`, and `sublocation` are now found inside `lmsPlacement`.
- In `getTotalReservations`, the `reservations` field in type `HoldingsForBibliographicalRecordLogisticsV1` is now optional. Therefore, I now return `0` if no reservations are found (undefined).
The 'holdings' data is an empty array, so the only change needed is to update the URL.
@kasperbirch1 kasperbirch1 force-pushed the DDFHER-83-implementer-nyt-beholdnings-endpoint branch from 7dcf07f to 6180aa9 Compare November 13, 2024 15:45
@kasperbirch1 kasperbirch1 changed the title WIP: DDFHER-83 - implementer nyt beholdnings endpoint /external/agencyid/catalog/holdingsLogistics/v1 DDFHER-83 - implementer nyt beholdnings endpoint /external/agencyid/catalog/holdingsLogistics/v1 Nov 14, 2024
@kasperbirch1 kasperbirch1 marked this pull request as ready for review November 14, 2024 12:59
@kasperbirch1 kasperbirch1 changed the title DDFHER-83 - implementer nyt beholdnings endpoint /external/agencyid/catalog/holdingsLogistics/v1 DDFHER-83 - implement new holdings endpoint /external/agencyid/catalog/holdingsLogistics/v1 Nov 14, 2024
kasperbirch1 added a commit to danskernesdigitalebibliotek/dpl-cms that referenced this pull request Nov 14, 2024
In the dpl-react project, we migrated from `/holdings/v3` to `/holdingsLogistics/v1`. Refer to the pull request: danskernesdigitalebibliotek/dpl-react#1443.

This change caused the `user-journey` Cypress test to fail.
…ldingsLogistics/v1`

I have updated the fixtures with fresh data to ensure that the data is as close to the reality as possible. Therefore, I have updated the test to align with the new fixture.

Since there was no instant loan for the material at the moment, I manually changed one of the branches. Because comments are not allowed in JSON, I added a key `dev_comment` with an explanation.

I also removed a non-helpful comment in the test.
Update due to API change from `holdings/v3` to `holdingsLogistics/v1`, causing the fixture to be out of date.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
…to `/holdingsLogistics/v1`

I have updated the fixtures with fresh data to ensure that the data is as close to the reality as possible. Therefore, I have updated the test to align with the new fixture.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
No need to update fixtures as no holdings in `material/holdings.json` are necessary for this test.
…oldingsLogistics/v1`

The current test fixtures appear to be manually created. I’ve updated them to reflect the new structure, but I suggest refactoring this test in the future. Ideally, it should be tested directly from the material app instead of relying on this "artificial" environment.
@kasperbirch1 kasperbirch1 force-pushed the DDFHER-83-implementer-nyt-beholdnings-endpoint branch from 53afae3 to 896ce28 Compare November 15, 2024 08:03
kasperbirch1 added a commit to danskernesdigitalebibliotek/dpl-cms that referenced this pull request Nov 15, 2024
In the dpl-react project, we migrated from `/holdings/v3` to `/holdingsLogistics/v1`. Refer to the pull request: danskernesdigitalebibliotek/dpl-react#1443.

This change caused the `user-journey` Cypress test to fail.
kasperbirch1 added a commit to danskernesdigitalebibliotek/dpl-cms that referenced this pull request Nov 19, 2024
In the dpl-react project, we migrated from `/holdings/v3` to `/holdingsLogistics/v1`. Refer to the pull request: danskernesdigitalebibliotek/dpl-react#1443.

This change caused the `user-journey` Cypress test to fail.
kasperbirch1 added a commit to danskernesdigitalebibliotek/dpl-cms that referenced this pull request Nov 28, 2024
In the dpl-react project, we migrated from `/holdings/v3` to `/holdingsLogistics/v1`. Refer to the pull request: danskernesdigitalebibliotek/dpl-react#1443.

This change caused the `user-journey` Cypress test to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants