Compare commits

..

3 commits

Author SHA1 Message Date
628b7b923f Update .github/workflows/pr-validation.yml 2026-03-26 14:27:35 +00:00
33427fb031 Merge pull request 'Configure Renovate' (#33) from renovate/configure into main
Reviewed-on: #33
2026-03-26 14:27:11 +00:00
Renovate Bot
12c817362a Add renovate.json
Some checks are pending
PR Validation / pr-validation (pull_request) Waiting to run
2026-03-26 05:01:07 +00:00
6 changed files with 33 additions and 38 deletions

View file

@ -1,19 +1,19 @@
name: PR Validation
on:
pull_request:
types: [opened]
permissions:
contents: read
jobs:
pr-validation:
permissions:
contents: read
pull-requests: write
runs-on: 'ubuntu-latest'
steps:
- uses: TimonVS/pr-labeler-action@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/configs/pr-labeler-configuration.yml
name: PR Validation
on:
pull_request:
types: [opened]
permissions:
contents: read
jobs:
pr-validation:
permissions:
contents: read
pull-requests: write
runs-on: nas
steps:
- uses: TimonVS/pr-labeler-action@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/configs/pr-labeler-configuration.yml

View file

@ -1,6 +1,6 @@
import express from 'express';
import { databaseServices } from '../index.js';
import { baseMedicationInformationSchema, fullMedicationInformationSchema } from '../validations/medications.js';
import { fullMedicationInformationSchema } from '../validations/medications.js';
export const medicationRouter = express.Router();
@ -17,13 +17,10 @@ medicationRouter.get('/', async (req, res) => {
}
});
medicationRouter.post('/base/', async (req, res) => {
medicationRouter.get('/base/', async (req, res) => {
let data;
const body = req?.body;
try {
await baseMedicationInformationSchema.validate(body);
data = await databaseServices.getBaseMedications(body);
data = await databaseServices.getBaseMedications();
res.status(200);
} catch (err) {
data = { Error: err?.message };

View file

@ -1,10 +1,10 @@
import { paramyxRunQuery } from '../../paramyxConnection.js';
export const medicationHelpers = {
getBaseMedications: async (region) => {
getBaseMedications: async () => {
const [medList, medRoutes] = await Promise.all([
paramyxRunQuery('SELECT * FROM medications WHERE $1 = ANY(region)', [region]),
paramyxRunQuery('SELECT * FROM medication_routes WHERE region = $1', [region])
paramyxRunQuery('SELECT * FROM medications'),
paramyxRunQuery('SELECT * FROM medication_routes')
]);
const medMap = {};

View file

@ -11,10 +11,9 @@ const getMedications = async () => {
}
};
const getBaseMedications = async (body) => {
const { region } = body;
const getBaseMedications = async () => {
try {
const dataResp = medicationHelpers.getBaseMedications(region);
const dataResp = medicationHelpers.getBaseMedications();
return dataResp;
} catch (err) {
console.log('GET BASE MEDICATIONS ERROR: ', err);
@ -22,8 +21,8 @@ const getBaseMedications = async (body) => {
}
}
const getFullMedicationInformation = async (body) => {
const { drugId } = body;
const getFullMedicationInformation = async (drug) => {
const { drugId } = drug;
try {
const dataResp = medicationHelpers.getFullMedicationInformation(drugId);
return dataResp;

View file

@ -1,9 +1,5 @@
import * as Yup from 'yup';
export const baseMedicationInformationSchema = Yup.object().shape({
region: Yup.string().required("region is required")
});
export const fullMedicationInformationSchema = Yup.object().shape({
drugId: Yup.string().required("drugId is required")
drugId: Yup.string().required("drugId is required"),
});

3
renovate.json Normal file
View file

@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}