ShiftSync/api/services/operations/medications.js

40 lines
1,015 B
JavaScript
Raw Normal View History

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;
}
};
2026-03-04 05:17:38 +00:00
const getBaseMedications = async (body) => {
const { region } = body;
try {
2026-03-04 05:17:38 +00:00
const dataResp = medicationHelpers.getBaseMedications(region);
return dataResp;
} catch (err) {
console.log('GET BASE MEDICATIONS ERROR: ', err);
throw err;
}
}
2026-03-04 05:17:38 +00:00
const getFullMedicationInformation = async (body) => {
const { drugId } = body;
try {
const dataResp = medicationHelpers.getFullMedicationInformation(drugId);
return dataResp;
} catch (err) {
console.log('GET FULL MEDICATION INFORMATION ERROR: ', err);
throw err;
}
}
export const medicationOperations = {
getMedications,
getBaseMedications,
getFullMedicationInformation
}