2026-01-18 03:39:32 +00:00
|
|
|
import { paramyxRunQuery } from '../paramyxConnection.js';
|
|
|
|
|
import { medicationHelpers } from './helpers/medications.js'
|
|
|
|
|
|
|
|
|
|
const getMedications = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const dataResp = await paramyxRunQuery('SELECT * FROM medications');
|
|
|
|
|
return dataResp;
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log('GET MEDICATIONS ERROR: ', err);
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getBaseMedications = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const dataResp = medicationHelpers.getBaseMedications();
|
|
|
|
|
return dataResp;
|
|
|
|
|
} catch (err) {
|
2026-01-18 06:26:01 +00:00
|
|
|
console.log('GET BASE MEDICATIONS ERROR: ', err);
|
2026-01-18 03:39:32 +00:00
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-23 06:21:47 +00:00
|
|
|
const getFullMedicationInformation = async (drug) => {
|
|
|
|
|
const { drugId } = drug;
|
2026-01-23 05:33:18 +00:00
|
|
|
try {
|
|
|
|
|
const dataResp = medicationHelpers.getFullMedicationInformation(drugId);
|
|
|
|
|
return dataResp;
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log('GET FULL MEDICATION INFORMATION ERROR: ', err);
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-18 03:39:32 +00:00
|
|
|
export const medicationOperations = {
|
|
|
|
|
getMedications,
|
2026-01-23 05:33:18 +00:00
|
|
|
getBaseMedications,
|
|
|
|
|
getFullMedicationInformation
|
2026-01-18 03:39:32 +00:00
|
|
|
}
|