Enhanced Validation and Renovation of Links in Bib/Instance Records
Description
Environment
Potential Workaround
CSP Request Details
CSP Rejection Details
Attachments
defines
is cloned by
is continued by
relates to
Checklist
hideTestRail: Results
Activity
Yauhen Viazau June 30, 2023 at 12:59 PM
This functionality will be tested in scope of UIQM-501 when it is done
Pavlo Smahin June 30, 2023 at 10:30 AM
Hey , your verification does not check the acceptance criteria described in the story. Your verification could be done after future changes in mod-quick-marc and UI.
Yauhen Viazau June 26, 2023 at 7:49 AM
Initial verification on Snapshot-1 - not working
This ticket does not seem to be implemented yet.
See, for example:
1) When updating authority while linked bib is being edited (save and not saved links), optimistic locking upon bib save -
2) When deleting authority while linked bib is being edited (not saved link), Bib record is saved but field still displayed as linked (QuickMARC, Instance view, Source view) -
3) When updating 1XX tag in authority while linked bib is being edited (not saved link), Bib record is saved but field still displayed as linked (QuickMARC, Instance view, Source view) -
- please review and respond whether this ticket can be tested as of now
Details
Details
Assignee

Purpose/Overview:
The purpose of this backend story is to enhance the PUT /links/instances/<id> endpoint in order to validate and update links in bib/instance records. This includes adding validation to reject saving links to deleted authorities and implementing a renovation process for controlled fields in the records.
Requirements/Scope:
The links endpoint needs to validate links and reject saving links to deleted authorities.
The endpoint should return a response with a 422 status code and include the UUIDs of the authorities that were not found in the system. This response will be used by the UI to display an error message, stop saving or show pop-ups, remove invalid links data, and allow for retrying. It will also be used by the mod-quick-marc module to remove invalid links and retry.
After the links are successfully saved to the database, the existing logic of links update based on authority update should be used to renovate controlled fields in bib/instance records.
Approach:
Implement validation in the mod-entities-links module by checking a flag in the authority_data table indicating whether the authority is actual or deleted.
Enhance the renovation logic by performing the following steps:
a. Batch-fetch authority records using the search endpoint.
b. Batch-fetch related source records using the source-record-storage endpoint.
c. Combine the fetched data into one Kafka message using the existing logic for creating similar messages.
d. Send the created message to the links.instance-authority Kafka topic.
No entry needs to be created in the authority_data_stats table because there are currently no authority changes, and tracking the renovation process in the table is unnecessary.
Acceptance criteria:
Validation is implemented in the mod-entities-links module, and it successfully rejects saving links to deleted authorities.
The PUT links endpoint returns a response with a 422 status code and includes the UUIDs of the authorities that were not found in the system.
The existing logic for renovating controlled fields in bib/instance records is triggered after the links are successfully saved to the database.
Unit tests are created/updated to cover the validation and renovation processes.
The module documentation is updated to reflect the changes made to the links endpoint, validation process, and renovation logic.
Logging is well-defined, ensuring appropriate logging messages are generated to track the validation and renovation activities in the system.