Skip to content

Commit

Permalink
Merge pull request #217 from mcode
Browse files Browse the repository at this point in the history
Bug fixes, enhancements and dockerizing the project
  • Loading branch information
LalanaChami authored Oct 5, 2022
2 parents 6c0f3e0 + 747d0f4 commit 5ffb326
Show file tree
Hide file tree
Showing 79 changed files with 9,272 additions and 6,967 deletions.
27 changes: 4 additions & 23 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
README.md
.git
node_modules
backend/node_modules
logs
14 changes: 14 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- zacharyrobin
- KeeyanGhoreshi
- smalho01

# A number of reviewers added to the pull request, Set to 0 to add all reviewers
numberOfReviewers: 0
22 changes: 22 additions & 0 deletions .github/workflows/ForkSync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Sync Fork

on:
schedule:
- cron: '30 14 * * 1' # every Monday at 14:30 UCT
workflow_dispatch: # on button click for manual testing

jobs:
sync:

runs-on: ubuntu-latest

steps:
- uses: tgymnich/[email protected] #1.4 is stable but may need to be updated
with:
owner: LalanaChami
base: master # Upstream
head: master # local
ignore_fail: true
auto_merge: false
pr_title: Fork Auto Sync
pr_message: Upstream repository has been updated - Please review changes
18 changes: 18 additions & 0 deletions .github/workflows/docker-base-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Base Image CI

on:
pull_request:
branches: [ master ]
workflow_dispatch:


jobs:
docker-base-ci:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v2

- name: Test Server Docker image Builds
run: docker build -f Dockerfile.base .
35 changes: 35 additions & 0 deletions .github/workflows/docker-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Image CD

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
docker-cd:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push Base Node Docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.base
push: true
tags: codexrems/node14-pkg-config:REMSvCurrent

- name: Build and push Server Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: codexrems/pharmacy-information-system:REMSvCurrent
18 changes: 18 additions & 0 deletions .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
pull_request:
branches: [ master ]
workflow_dispatch:


jobs:
docker-ci:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v2

- name: Test Server Docker image Builds
run: docker build .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

node_modules/
backend/node_modules/
logs/

# compiled output
/dist
/tmp
Expand Down
45 changes: 41 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Docker Node.js Launch",
"type": "docker",
"name": "Debug Pharmacy-Information-System Backend (Docker)",
"port": 3011,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/node/app/pharmacy-information-system",
"restart": true
},
{
"name": "Debug Pharmacy-Information-System Backend (Local)",
"port": 3011,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"restart": true
},
{
"type": "chrome",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"platform": "node"
"name": "Debug Pharmacy-Information-System Frontend (Launch Local + Docker)",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}",
"runtimeArgs": [
"--remote-debugging-port=9222"
]
},
{
"type": "chrome",
"request": "attach", // Launch Chrome According To: https://github.com/microsoft/vscode-chrome-debug#attach
"name": "Debug Pharmacy-Information-System Frontend (Attach Local + Docker)",
"url": "http://localhost:4200/*",
"port": 9222,
"webRoot": "${workspaceFolder}",
}
]
}
39 changes: 0 additions & 39 deletions .vscode/tasks.json

This file was deleted.

18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM node:12.18-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 8080
CMD npm start
FROM codexrems/node14-pkg-config:REMSvCurrent
WORKDIR /home/node/app/pharmacy-information-system
COPY --chown=node:node . .
RUN npm install
WORKDIR /home/node/app/pharmacy-information-system/backend
RUN npm install
WORKDIR /home/node/app/pharmacy-information-system
EXPOSE 3010
EXPOSE 4200
CMD node backend/populatedb.js && npm run start
4 changes: 4 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM node:14
RUN \
apt-get update -y && \
apt-get install xserver-xorg-dev libxi-dev libxext-dev -y
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM codexrems/node14-pkg-config:latest
WORKDIR /home/node/app/pharmacy-information-system
COPY --chown=node:node . .
RUN npm install
WORKDIR /home/node/app/pharmacy-information-system/backend
RUN npm install
WORKDIR /home/node/app/pharmacy-information-system
EXPOSE 3010
EXPOSE 4200
EXPOSE 3011
CMD ./dockerRunnerDev.sh
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Star :star: the repo to help the developers :innocent:

<table>
<tr>
<td>Doctor Oders</td>
<td>Verified Doctor Oders</td>
<td>Doctor Orders</td>
<td>Verified Doctor Orders</td>
</tr>
<tr>
Expand Down Expand Up @@ -109,14 +109,15 @@ Star :star: the repo to help the developers :innocent:
3) cd (change directory) in to the project folder
4) Run `npm install` in your terminal
5) Run `ng serve` to run the Angular frontend
6) Run `npm run start:server` to run the backend Node server
7) Open your browser and navigate to `http://localhost:4200/`
6) Start backend database using docker. Run `docker run --name rems_local_pharmacy-information-system-database --expose 27017 -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME='pharmacy-information-root' -e MONGO_INITDB_ROOT_PASSWORD='pharmacy-information-password' -v rems_local_pharmacy-infomation-system-database:/data/db mongo`
7) Run `npm run start:server` to run the backend Node server
8) Open your browser and navigate to `http://localhost:4200/`


## 🚨 Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
Run `npm run start:serve` for a backend server. Navigate to `http://localhost:3000/`.
Run `npm run start:serve` for a backend server. Navigate to `http://localhost:3010/`.

## 🚨 Code scaffolding

Expand All @@ -133,7 +134,3 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
## 🚨 Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## 🚨 Further help

To get more help on this please email "[email protected]" or feel free to open a issue
25 changes: 13 additions & 12 deletions backend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@ const inventoryRoutes = require('./routes/inventory');
const userRoutes = require('./routes/user');
const salesRoutes = require('./routes/sales');
const doctorUserRoutes = require('./routes/doctorUser');
const doctorOderRoutes = require('./routes/doctorOders');
const verifiedDoctorOderRoutes = require('./routes/verifiedDoctorOder');
const pickedUpOdersRoutes = require('./routes/pickedUpOders');
const doctorOrderRoutes = require('./routes/doctorOrders');
// const verifiedDoctorOrderRoutes = require('./routes/verifiedDoctorOrder');
// const pickedUpOrdersRoutes = require('./routes/pickedUpOrders');



mongoose.connect('mongodb+srv://lalana:[email protected]/pharmacy?retryWrites=true&w=majority',{useNewUrlParser: true , useUnifiedTopology: true})
const mongoConnString = process.env.MONGODB_CONNSTRING ? process.env.MONGODB_CONNSTRING : 'mongodb://pharmacy-information-root:pharmacy-information-password@localhost:27017?retryWrites=true&w=majority';
mongoose.connect(mongoConnString, {useNewUrlParser: true , useUnifiedTopology: true})
.then(()=>{
console.log('connected to database!');
})
.catch(()=>{
.catch((e)=>{
console.log(e);
console.log('connection failed! ');
});
});
mongoose.set('useCreateIndex', true);

//OJx2X4IllVNl9up4


app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({ extended: false, limit: '50mb' }));
app.use("/images" , express.static(path.join("images")));


Expand Down Expand Up @@ -113,8 +114,8 @@ app.use("/api/inventory",inventoryRoutes);
app.use("/api/user",userRoutes);
app.use("/api/sales",salesRoutes);
app.use("/api/doctorUser",doctorUserRoutes);
app.use("/api/doctorOder",doctorOderRoutes);
app.use("/api/verifiedDoctorOder",verifiedDoctorOderRoutes);
app.use("/api/pickedUpOders",pickedUpOdersRoutes);
app.use("/api/doctorOrder",doctorOrderRoutes);
// app.use("/api/verifiedDoctorOrder",verifiedDoctorOrderRoutes);
// app.use("/api/pickedUpOrders",pickedUpOrdersRoutes);

module.exports = app;
14 changes: 11 additions & 3 deletions backend/models/doctorOders.js → backend/models/doctorOrders.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const mongoose = require('mongoose');

const doctorOderSchema = mongoose.Schema({
const doctorOrderSchema = mongoose.Schema({
patientName: {type: String , require:true},
patientDOB: {type: String , require:true},
doctorName: {type: String , require:true},
doctorContact: {type: String , require:true},
doctorID: {type: String , require:true},
Expand All @@ -11,7 +13,13 @@ const doctorOderSchema = mongoose.Schema({
drugQuantity: {type: Array , require:true},
realQuantity: {type: Array , require:true},
totalAmount : { type: String , require: true},
pickupDate : { type: String , require: true}
pickupDate : { type: String , require: true},
actualDate : { type: String , require: true},
dispenseStatus : { type: String , require: true},
caseNumber : { type: String , require: false},
//send full object here
rawFHIRObject : { type: Object, require: false}
})

module.exports = mongoose.model('DoctorOder',doctorOderSchema);
module.exports = mongoose.model('DoctorOrder',doctorOrderSchema);

Loading

0 comments on commit 5ffb326

Please sign in to comment.