Currently retrieving records is done using voyager-record-fetch-cgi. This requires an external service. The current implementation of the service also has a bug which sometimes prevents the record from being updated (Although Batchcat DLL doesn't report an error but the record isn't updated).
Using a direct SQL connection to Voyager database removes the need to use an external service and allow the bug to be fixed in this codebase.
Specification
Configuration
Configuration file (fetchApi property is no longer needed)
TNS_ADMIN: Path to tnsnames.ora (See aleph-change-listener on how this is configured
Implementation
Fetching data
Record data is requested: SELECT marc_record FROM foodb.bibblob_vw WHERE bib_id = 124567
If the record's last update time is requested: SELECT create_date,update_date FROM bib_master WHERE bib_id = 1234567;
MARC record object is created from the retrieved data: MarcRecord.fromString(data)
Record history is requested: SELECT action_date, location_id, action_type_id, e, s FROM foodb.bib_history WHERE bib_id = 124567 ORDER BY action_date desc
The record is returned unless the last update time was requested as well: { record: [MarcRecord], lastUpdateTime: [Date] }
If the record is to be updated, the last update time is passed on to voyager-batchcat-js because the value fetched from the record's 005 may be out of sync. This depends on natlibfi/voyager-batchcat-js#2.
Description
Currently retrieving records is done using voyager-record-fetch-cgi. This requires an external service. The current implementation of the service also has a bug which sometimes prevents the record from being updated (Although Batchcat DLL doesn't report an error but the record isn't updated).
Using a direct SQL connection to Voyager database removes the need to use an external service and allow the bug to be fixed in this codebase.
Specification
Configuration
Configuration file (fetchApi property is no longer needed)
Environment variables
Implementation
SELECT marc_record FROM foodb.bibblob_vw WHERE bib_id = 124567
SELECT create_date,update_date FROM bib_master WHERE bib_id = 1234567;
MarcRecord.fromString(data)
SELECT action_date, location_id, action_type_id, e, s FROM foodb.bib_history WHERE bib_id = 124567 ORDER BY action_date desc
moment(value, 'DD.MM.YYYY HH:mm:ss').format()
Number.parseInt(value)
Number.parseInt(value)
Number.parseInt(value)
value === 'Y' ? true : false
{ record: [MarcRecord], lastUpdateTime: [Date] }