Compare commits
3 commits
refactor/u
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 628b7b923f | |||
| 33427fb031 | |||
|
|
12c817362a |
6 changed files with 33 additions and 38 deletions
38
.github/workflows/pr-validation.yml
vendored
38
.github/workflows/pr-validation.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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 = {};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
3
renovate.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||
}
|
||||
Loading…
Reference in a new issue