Skip to content

Commit

Permalink
PDR-224: updating cron to search for status=established (#333)
Browse files Browse the repository at this point in the history
* PDR-224: updating cron to search for status=established

* adding semicolons
  • Loading branch information
cameronpettit authored Nov 29, 2023
1 parent 78aa3dd commit 42ef212
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lambda/dataRegisterUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const { logger } = require('./logger');

const DATA_REGISTRY_URL = process.env.DATA_REGISTRY_URL;
const DATA_REGISTER_NAME_API_KEY = process.env.DATA_REGISTER_NAME_API_KEY;
const ESTABLISHED_STATE = 'established';

async function getCurrentNameData(identifier) {
const url = DATA_REGISTRY_URL + `/parks/${identifier}/name?status=current`
const url = DATA_REGISTRY_URL + `/parks/${identifier}/name?status=${ESTABLISHED_STATE}`;
try {
const data = await axios({
method: 'get',
Expand All @@ -18,7 +19,7 @@ async function getCurrentNameData(identifier) {
})
return data;
} catch (err) {
logger.error(`Failed to get current name data for ${identifier}.`, err);
logger.error(`Failed to get established name data for ${identifier}.`, err);
throw err;
}
}
Expand All @@ -30,7 +31,7 @@ async function getCurrentDisplayNameById(identifier) {
let item = data?.data?.data?.items[0];
return item?.displayName || null;
} catch (err) {
logger.error('Failed to get current display name by id.', err);
logger.error('Failed to get established display name by id.', err);
throw err;
}
}
Expand Down

0 comments on commit 42ef212

Please sign in to comment.