Add parse #30
3 changed files with 5 additions and 3 deletions
|
|
@ -33,9 +33,10 @@ medicationRouter.get('/base/', async (req, res) => {
|
||||||
medicationRouter.post('/full/', async (req, res) => {
|
medicationRouter.post('/full/', async (req, res) => {
|
||||||
let data;
|
let data;
|
||||||
const body = req?.body;
|
const body = req?.body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fullMedicationInformationSchema.validate(body);
|
await fullMedicationInformationSchema.validate(body);
|
||||||
data = await databaseServices.getFullMedicationInformation(body?.drugId);
|
data = await databaseServices.getFullMedicationInformation(body);
|
||||||
res.status(200);
|
res.status(200);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
data = { Error: err?.message };
|
data = { Error: err?.message };
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ export const medicationHelpers = {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const fullMedicationInformation = {
|
const fullMedicationInformation = {
|
||||||
...medInformation
|
...medInformation[0]
|
||||||
};
|
};
|
||||||
|
|
||||||
medRoutes?.forEach((row) => {
|
medRoutes?.forEach((row) => {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ const getBaseMedications = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFullMedicationInformation = async (drugId) => {
|
const getFullMedicationInformation = async (drug) => {
|
||||||
|
const { drugId } = drug;
|
||||||
try {
|
try {
|
||||||
const dataResp = medicationHelpers.getFullMedicationInformation(drugId);
|
const dataResp = medicationHelpers.getFullMedicationInformation(drugId);
|
||||||
return dataResp;
|
return dataResp;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue