Skip to content

Commit

Permalink
Updated console logs to log less data
Browse files Browse the repository at this point in the history
  • Loading branch information
jtquach1 committed Feb 12, 2024
1 parent 84ff98e commit d358f67
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions backend/src/routes/doctorOrders.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ router.get('/api/getRx', async (req, res) => {
// finding all and adding it to the db
const order = await doctorOrder.find();

console.log('Database return: ');
console.log(order);
console.log('Database returned with order');
res.json(order);
});

Expand All @@ -48,24 +47,23 @@ router.post('/api/addRx', async (req, res) => {
serializedJSON: JSON.stringify(newRxMessageConvertedToJSON)
});
await newRx.save();
console.log('Saved NewRx');
} catch (error) {
console.log('Could not store the NewRx', error);
return error;
}

try {
await newOrder.save();
console.log('DoctorOrder was saved');
} catch (error) {
console.log('ERROR! duplicate found, prescription already exists', error);
return error;
}

console.log('POST DoctorOrder: ', newOrder);

const RxStatus = buildRxStatus(newRxMessageConvertedToJSON);
console.log('RxStatus:', RxStatus);

res.send(RxStatus);
console.log('Sent RxStatus');
});

/**
Expand All @@ -77,9 +75,7 @@ router.patch('/api/updateRx/:id', async (req, res) => {
const dontUpdateStatusBool = req.query.dontUpdateStatus;
// Finding by id
const order = await doctorOrder.findById(req.params.id).exec();
console.log('found by id!');

console.log('Current order', order);
console.log('Found doctor order by id!');

// Reaching out to REMS Admin finding by pt name and drug name
// '/etasu/met/patient/:patientFirstName/:patientLastName/:patientDOB/drug/:drugName',
Expand All @@ -95,9 +91,8 @@ router.patch('/api/updateRx/:id', async (req, res) => {
order.patientDOB +
'/drug/' +
order.simpleDrugName;
console.log(url);
const response = await axios.get(url);
console.log(response.data);
console.log('Retrieved order');

// Saving and updating
const newOrder = await doctorOrder.findOneAndUpdate(
Expand All @@ -115,7 +110,7 @@ router.patch('/api/updateRx/:id', async (req, res) => {
);

res.send(newOrder);
console.log('Updated order', newOrder);
console.log('Updated order');
} catch (error) {
console.log('Error', error);
return error;
Expand All @@ -136,6 +131,7 @@ router.patch('/api/updateRx/:id/pickedUp', async (req, res) => {
);
res.send(newOrder);
prescriberOrderNumber = newOrder.prescriberOrderNumber;
console.log('Updated dispense status to picked up');
} catch (error) {
console.log('Could not update dispense status', error);
return error;
Expand Down Expand Up @@ -186,9 +182,8 @@ router.get('/api/getRx/:patientFirstName/:patientLastName/:patientDOB', async (r
}

const prescription = await doctorOrder.findOne(searchDict).exec();
console.log('Found doctor order');

console.log('GET DoctorOrder: ');
console.log(prescription);
res.send(prescription);
});

Expand All @@ -197,7 +192,7 @@ router.get('/api/getRx/:patientFirstName/:patientLastName/:patientDOB', async (r
*/
router.delete('/api/deleteAll', async (req, res) => {
await doctorOrder.deleteMany({});
console.log('All doctorOrders deleted in PIMS!');
console.log('All doctor orders deleted in PIMS!');
await NewRx.deleteMany({});
console.log("All NewRx's deleted in PIMS!");
res.send([]);
Expand Down

0 comments on commit d358f67

Please sign in to comment.