orvosi-api

module
v0.0.0-...-c56863d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: MIT

README

Orvosi API

Go Report Card Workflow codecov Maintainability Go Reference

Description

Orvosi API provides HTTP REST API for Orvosi application. This project was previously placed in https://github.com/orvosi/api which I own. Then, I decided to move this repository to my personal github.

SLI and SLO

  • Availability: TBD
  • Average response time
    • POST /sign-in: TBD
    • POST /medical-records: TBD
    • GET /medical-records: TBD
    • GET /medical-records/:id: TBD
    • PUT /medical-records/:id: TBD

Architecture Diagram

orvosi-arch

Owner

Indra Saputra

Onboarding and Development Guide

How to Run
  • Install Go

    We use version 1.16. Follow Golang installation guideline.

  • Install PostgreSQL

    Follow PostgreSQL installation guideline.

  • Go to project folder

    Usually, it would be cd go/src/github.com/indrasaputra/orvosi-api.

  • Run the database

    • Make sure to run PostgreSQL.
  • Fill in the environment variables

    Copy the sample env file.

    cp env.sample .env
    

    Then, fill the values according to your setting in .env file.

  • Download the dependencies

    make dep-download
    

    or run this command if you don't have make installed in your local.

    go mod download 
    
  • Run the database migration

    Install golang-migrate. Follow Golang Migrate CLI.

    Run the migration command.

    make migrate url=<database url>
    

    e.g:

    make migrate url=postgres://user:password@localhost:5432/orvosi
    
  • Run the application

    go run app/api/main.go
    
Development Guide
  • Fork the project

  • Create a meaningful branch

    git checkout -b <your-goal>
    

    e.g:

    git checkout -b strenghten-security-on-sign-in-process
    
  • Create some changes and their tests (unit test and any test if any).

  • Make sure to have unit test coverage at least 90%. There will be times when the code is quite hard to test. Please, explain it in your Pull Request.

  • Push the changes to repository.

  • Create Pull Request (PR) for your branch. In your PR's description, please explain the goal of the PR and its changes.

  • Ask the other contributors to review.

  • Once your PR is approved and its pipeline status is green, ask the owner to merge your PR.

Request Flows

See Request Flows

Endpoints

See Endpoints

Code Map

See Code Map

Dependencies

  • PostgreSQL

Directories

Path Synopsis
app
api
Package entity defines all core structs or domains of API.
Package entity defines all core structs or domains of API.
internal
builder
Package builder provides functionality to build representative flow.
Package builder provides functionality to build representative flow.
config
Package config provides the functionality of managing configuration.
Package config provides the functionality of managing configuration.
http/handler
Package handler provides the functionality of REST HTTP.
Package handler provides the functionality of REST HTTP.
http/middleware
Package middleware provides HTTP middleware
Package middleware provides HTTP middleware
http/response
Package response provides data structure to build HTTP JSON response structure.
Package response provides data structure to build HTTP JSON response structure.
http/router
Package router provides the functionality routing the HTTP request.
Package router provides the functionality routing the HTTP request.
http/server
Package server provides the functionality HTTP server.
Package server provides the functionality HTTP server.
repository
Package repository provides real connection to storage.
Package repository provides real connection to storage.
tool
Package tool provides tool functionalities Google Idtoken decoder.
Package tool provides tool functionalities Google Idtoken decoder.
test
mock/usecase
Package mock_usecase is a generated GoMock package.
Package mock_usecase is a generated GoMock package.
Package usecase defines the business logic of the requirements.
Package usecase defines the business logic of the requirements.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL