Feature/api paramyxrx #25

Merged
mattdimegs merged 10 commits from feature/api-paramyxrx into main 2026-01-18 06:26:01 +00:00
2 changed files with 4 additions and 8 deletions
Showing only changes of commit f7da171561 - Show all commits

View file

@ -1,16 +1,11 @@
export const validateMedicationApiKey = (req, res, next) => {
console.log('req: ', req);
console.log('req.headers: ', req.headers);
const authHeader = req.headers['authorization'];
console.log('authHeader: ', authHeader);
const token = authHeader && authHeader.split(' ')[1];
console.log('token: ', token);
console.log('process.env.MEDICATION_API_KEY: ', process.env.MEDICATION_API_KEY);
if (!token || token !== process.env.MEDICATION_API_KEY) {
console.log('into the token not ok');
console.log('MEDICATION - User entered an Invalid token: ', token);
return res.status(401).json({ error: 'Unauthorized - Invalid API Key' });
}
console.log('off to next');
next();
};
@ -19,6 +14,7 @@ export const validateShiftSyncApiKey = (req, res, next) => {
const token = authHeader && authHeader.split(' ')[1];
if (!token || token !== process.env.SHIFTSYNC_API_KEY) {
console.log('SHIFT - User entered an Invalid token: ', token);
return res.status(401).json({ error: 'Unauthorized - Invalid API Key' });
}

View file

@ -16,7 +16,7 @@ const getBaseMedications = async () => {
const dataResp = medicationHelpers.getBaseMedications();
return dataResp;
} catch (err) {
console.log('GET MEDICATIONS ERROR: ', err);
console.log('GET BASE MEDICATIONS ERROR: ', err);
throw err;
}
}