Skip to content

Commit

Permalink
release: develop to main (#85)
Browse files Browse the repository at this point in the history
* chore: add signup usecase implementation (#11)

* implement login usecase (#13)

* chore: layout and implement create facility API

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* chore: implement create facility api logic (#20)

Create a healthcare facility
MFL code must be unique accross platform
Map the output to a format that can be consumed by frontend

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* chore: wire up ci configuration and unit tests (#22)

Depend on postgreSQL docker image for integration tests
Write mocks for unit testing

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* chore: add fetch all facilities api (#24)

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* feat: implement retrieve one facility by id (#21)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* feat: add delete facility feature (#25)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* chore: replace int id with uuid (#26)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* add metrics capture feature (#27)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* chore: make api usecases scaffold (#28)

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* chore: scaffold staff usecases (#31)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* chore: fetch by active status and ensure facility creation idempotency (#32)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* chore: scaffold client and user usecases (#33)

Signed-off-by: Otieno Calvine <nyarangaotieno@gmail.com>

* chore: scaffold user staff models (#34)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* chore: change uuid to type string (#37)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* feat: implement set up user pin to save user's pin and exponential back off (#40)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* chore: implement register staff user (#39)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* feat: implement set up user's login api (#36)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: create client-user profile (#41)

* feat: implement contacts, languages, user input for staff user (#42)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* feat: implement adding client identifiers (#43)

* implement exponential back off (#44)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: implement staff address (#45)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* feat: implement roles (#46)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* add update staff user acddress and contacts (#47)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: add invite client API (#50)

This MR adds a feature where we send an invite to a user (client/staff).
The invite contains a link to the app/play store and a temporary pin.
The invite channel is SMS

* add transfer client feature (#48)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: implement reset pin (#52)

This functionality can be used by admins or healthcare workers to generate and send
a new PIN for a client or other user. The new PIN is generated automatically.

* feat: implement ans ship facility usecase (#54)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* chore: update service name (#55)

* chore: add database envs (#56)

* fix: minor tweaks (#57)

* feat: implement creating a user with a client profile (#59)

* update and standardize facility mock test (#61)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: add set user pin API (#60)

This adds the functionality for setting a user pin. It can be used to
set a PIN for the first time or even change the pin, on first login
after invite or after a pin expires

* feat: paginate facilities (#58)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* fix: update deployment pipeline (#65)

The deployment pipeline is updated to: When we merge to develop, it
deploys to the testing environment and when we deploy to main branch, it
deploys to prod.

* refactor code to enforce loose coupling for easier testing (#64)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: implement login by phone (#63)

* feat: filter facilities (#59) (#66)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* test: add gorm integration tests (#67)

* chore: publish schema to test schema registry (#68)

* fix: add Schema Registry CLI command version (#69)

* fix: add schema registry URL env variable (#71)

* fix: add registry URL env variable (#73)

* fix: add url flag argument to push schema command (#74)

* restore and fix usecase unit tests (#72)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* add client usecase unit tests (#78)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* fix: update onboarding service version (#75)

* chore: publish schema to prod schema registry (#80)

* add client usecase set user pin unit tests (#79)

Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>

* feat: search facilities (#76)

Signed-off-by: maxwellgithinji <maxwellgithinji@gmail.com>

* chore: remove unwanted files (#83)

Co-authored-by: Maxwell Githinji <maxwellgithinji@gmail.com>
Co-authored-by: Kathurima Kimathi <41376826+KathurimaKimathi@users.noreply.github.com>
Co-authored-by: Otieno Calvine <nyarangaotieno@gmail.com>
Co-authored-by: Otieno Calvine <35563516+NYARAS@users.noreply.github.com>
  • Loading branch information
5 people committed Nov 4, 2021
1 parent e882a32 commit c9f958d
Show file tree
Hide file tree
Showing 135 changed files with 17,262 additions and 14,320 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ jobs:
go-version: [1.16.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 80
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master
Expand Down Expand Up @@ -59,19 +69,28 @@ jobs:
go get github.com/stretchr/testify/assert@v1.7.0
go get github.com/ory/go-acc
go install github.com/savannahghi/bewellcli@$CLI_VERSION
go get golang.org/x/oauth2/internal
- name: Run lint and test
env:
# These are the expected database envs
DB_HOST: localhost
DB_USER: test
DB_PASS: test
DB_NAME: test
DB_PORT: 5432
IS_LOCAL_DB: True
run: |
staticcheck ./...
bewellcli service validate-schema --name onboarding --version $GITHUB_SHA --url ${{ secrets.SERVICE_GRAPHQL_URL }}
bewellcli service validate-schema --name mycarehub --version $GITHUB_SHA --url ${{ secrets.SERVICE_GRAPHQL_URL }}
go fmt $(go list ./... | grep -v /vendor/)
go vet $(go list ./... | grep -v /vendor/)
golint -set_exit_status $(go list ./... | grep -v /vendor/)
errcheck -ignore 'os:.*,' $(go list ./... | grep -v /vendor/)
misspell -error .
gosec -exclude=G304,G101 ./...
go-acc -o coverage.txt --ignore generated,cmd ./... -- -timeout 60m
grep -v "generated.go" coverage.txt | grep -v "_gen.go" | grep -v "mocks.go" | grep -v "*resolver*go" | grep -v "server.go" > coverage.out
grep -v "generated.go" coverage.txt | grep -v "_gen.go" | grep -v "mocks.go" | grep -v "*resolvers.go" | grep -v "*.resolvers.go" | grep -v "server.go" > coverage.out
go tool cover -html=coverage.out -o coverage.html
gocov convert coverage.out > coverage.json
gocov report coverage.json > coverage_report.txt
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Deployment

on: push

env:
# Schema Registry CLI command version
CLI_VERSION: v0.0.1


concurrency:
group: build_and_push_image

Expand Down Expand Up @@ -36,9 +41,13 @@ jobs:
deploy_to_test:
name: Deploy Test Server to Google Cloud Run
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
environment:
name: test
needs: [build_and_push_image]
env:
# Schema Registry URL
REGISTRY_URL: ${{ secrets.TEST_SCHEMA_REGISTRY_URL }}
steps:
- name: Checkout working branches
uses: actions/checkout@v2
Expand Down Expand Up @@ -72,14 +81,23 @@ jobs:
--set-env-vars "GOOGLE_PROJECT_NUMBER=${{ secrets.GOOGLE_PROJECT_NUMBER }}" \
--set-env-vars "JAEGER_URL=${{ secrets.JAEGER_URL }}" \
--set-env-vars "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" \
--set-env-vars "DB_USER=${{ secrets.MYCAREHUB_DB_USER }}" \
--set-env-vars "DB_PASS=${{ secrets.MYCAREHUB_DB_PASS }}" \
--set-env-vars "DB_NAME=${{ secrets.TESTING_MYCAREHUB_DB_NAME }}" \
--set-env-vars "DATABASE_REGION=${{ secrets.PROD_DATABASE_REGION }}" \
--set-env-vars "DATABASE_INSTANCE=${{ secrets.PROD_DATABASE_INSTANCE }}" \
--set-env-vars "ROOT_COLLECTION_SUFFIX=${{ secrets.ROOT_COLLECTION_SUFFIX }}"
deploy_to_prod:
name: Deploy Prod Server to Google Cloud Run
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: production
needs: [build_and_push_image]
env:
# Schema Registry URL
REGISTRY_URL: ${{ secrets.PROD_SCHEMA_REGISTRY_URL }}
steps:
- name: Checkout working branches
uses: actions/checkout@v2
Expand Down Expand Up @@ -113,4 +131,66 @@ jobs:
--set-env-vars "GOOGLE_PROJECT_NUMBER=${{ secrets.GOOGLE_PROJECT_NUMBER }}" \
--set-env-vars "JAEGER_URL=${{ secrets.JAEGER_URL }}" \
--set-env-vars "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" \
--set-env-vars "DB_USER=${{ secrets.MYCAREHUB_DB_USER }}" \
--set-env-vars "DB_PASS=${{ secrets.MYCAREHUB_DB_PASS }}" \
--set-env-vars "DB_NAME=${{ secrets.PROD_MYCAREHUB_DB_NAME }}" \
--set-env-vars "DATABASE_REGION=${{ secrets.PROD_DATABASE_REGION }}" \
--set-env-vars "DATABASE_INSTANCE=${{ secrets.PROD_DATABASE_INSTANCE }}" \
--set-env-vars "ROOT_COLLECTION_SUFFIX=${{ secrets.ROOT_COLLECTION_SUFFIX }}"
push_schema_test_registry:
name: Publish schema to schema registry
strategy:
matrix:
go-version: [1.16.x]
runs-on: ubuntu-latest
needs: [deploy_to_test]
env:
# Schema Registry URL
REGISTRY_URL: ${{ secrets.TEST_SCHEMA_REGISTRY_URL }}
steps:
- name: Checkout working branches
uses: actions/checkout@v2

# Install Go
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

# install CLI command and push schema to registry
# just to be sure, we re-validate the schema against schema registry
- name: Install CLI command and push schema to registry
run: |
go install github.com/savannahghi/bewellcli@$CLI_VERSION
bewellcli service validate-schema --name mycarehub --version $GITHUB_SHA --url https://mycarehub-testing.savannahghi.org/graphql
bewellcli service push-schema --name mycarehub --version $GITHUB_SHA --url https://mycarehub-testing.savannahghi.org/graphql
push_schema_prod_registry:
name: Publish schema to prod schema registry
strategy:
matrix:
go-version: [1.16.x]
runs-on: ubuntu-latest
needs: [deploy_to_prod]
env:
# Schema Registry URL
REGISTRY_URL: ${{ secrets.PROD_SCHEMA_REGISTRY_URL }}
steps:
- name: Checkout working branches
uses: actions/checkout@v2

# Install Go
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

# install CLI command and push schema to registry
# just to be sure, we re-validate the schema against schema registry
- name: Install CLI command and push schema to registry
run: |
go install github.com/savannahghi/bewellcli@$CLI_VERSION
bewellcli service validate-schema --name mycarehub --version $GITHUB_SHA --url https://mycarehub-prod.savannahghi.org/graphql
bewellcli service push-schema --name mycarehub --version $GITHUB_SHA --url https://mycarehub-prod.savannahghi.org/graphql
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CMD go mod download
COPY . /app/

# Build the binary.
RUN cd /app/ && CGO_ENABLED=0 GOOS=linux go build -v -o server github.com/savannahghi/onboarding-service
RUN cd /app/ && CGO_ENABLED=0 GOOS=linux go build -v -o server github.com/savannahghi/mycarehub

# Use the official Alpine image for a lean production container.
# https://hub.docker.com/_/alpine
Expand All @@ -29,8 +29,8 @@ RUN echo "Africa/Nairobi" > /etc/timezone && date
COPY --from=builder /app/server /server
COPY --from=builder /app/deps.yaml /deps.yaml

COPY --from=builder /app/pkg/onboarding/application/authorization/rbac_model.conf /app/pkg/onboarding/application/authorization/rbac_model.conf
COPY --from=builder /app/pkg/onboarding/application/authorization/data/rbac_policy.csv /app/pkg/onboarding/application/authorization/data/rbac_policy.csv
COPY --from=builder /app/pkg/mycarehub/application/authorization/rbac_model.conf /app/pkg/mycarehub/application/authorization/rbac_model.conf
COPY --from=builder /app/pkg/mycarehub/application/authorization/data/rbac_policy.csv /app/pkg/mycarehub/application/authorization/data/rbac_policy.csv

# Run the web service on container startup.
CMD ["/server"]
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Onboarding service
# MyCareHub service

![Linting and Tests](https://github.com/savannahghi/onboarding-service/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/savannahghi/onboarding-service/badge.svg?branch=main)](https://coveralls.io/github/savannahghi/onboarding-service?branch=main)
![Linting and Tests](https://github.com/savannahghi/mycarehub/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/savannahghi/mycarehub/badge.svg?branch=develop)](https://coveralls.io/github/savannahghi/mycarehub?branch=develop)

This service manages user onboarding process.
This service contains the implementation of the mycarehub project.

## Description

The project implements the `Clean Architecture` advocated by
Robert Martin ('Uncle Bob').

### Clean Architecture

A cleanly architected project should be:
Expand Down Expand Up @@ -97,8 +98,7 @@ export REPOSITORY="firebase" # when we switch to PG the value will be `postgres`

```

Deployment
----------
## Deployment

This application is deployed via Google Cloud Build ( <https://cloud.google.com/build> ) to Google Cloud Run ( <https://cloud.google.com/run> ).
There's a `cloudbuild.yaml` file in the home folder. Secrets (e.g production settings) are managed with Google Secret Manager ( <https://cloud.google.com/secret-manager> ).
29 changes: 0 additions & 29 deletions cmd/generator/main.go

This file was deleted.

3 changes: 3 additions & 0 deletions deps.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
staging:
- depName: engagement
depRootDomain: https://engagement-staging.healthcloud.co.ke
testing:
- depName: engagement
depRootDomain: https://engagement-testing.savannahghi.org
Expand Down
1 change: 0 additions & 1 deletion documentation/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions documentation/Dockerfile

This file was deleted.

Loading

0 comments on commit c9f958d

Please sign in to comment.