Skip to content

Commit

Permalink
Merge pull request #2 from communitybridge/SwaggerContract
Browse files Browse the repository at this point in the history
swaggerContract
  • Loading branch information
fayazg authored Oct 16, 2019
2 parents 823fb24 + a373161 commit a3d1a12
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 21 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.1
jobs:
build:
docker:
- image: circleci/golang:1.13.1-stretch-node
- image: circleci/golang:1.12.10-buster-node
working_directory: /go/src/github.com/communitybridge/ledger/
steps:
- checkout
Expand All @@ -19,16 +19,16 @@ jobs:
- run:
name: Validate Swagger
command: |
make swagger-validate
- run:
name: Lint
command: |
make lint
make validate
- run:
name: Build
command: |
make build
- run:
name: Test
command: |
make test
make test
- run:
name: Lint
command: |
make lint
7 changes: 4 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ COMMIT := $(shell sh -c 'git rev-parse --short HEAD')
LDFLAGS=-ldflags "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.branch=$(BRANCH) -X main.buildDate=$(BUILD_TIME)"
BUILD_TAGS=-tags aws_lambda
LINT_TOOL=$(shell go env GOPATH)/bin/golangci-lint
GO_PKGS=$(shell go list ./... | grep -v /vendor/ | grep -v /node_modules/)
GO_FILES=$(shell find . -type f -name '*.go' -not -path './vendor/*')

setup_dev:
go get -u github.com/go-swagger/go-swagger/
# https://github.com/golangci/golangci-lint#ci-installation
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.18.0
go get -u github.com/go-swagger/go-swagger/cmd/swagger
go get -u github.com/golang/dep/cmd/dep
go get -u github.com/amacneil/dbmate

setup_deploy:
yarn install --frozen-lockfile
Expand All @@ -22,7 +24,7 @@ setup: setup_dev setup_deploy
clean:
rm -rf ./gen ./bin

swagger-validate:
validate:
swagger validate swagger/$(SERVICE).yaml

swagger: clean
Expand All @@ -46,7 +48,7 @@ build: deps
chmod +x bin/$(SERVICE)

$(LINT_TOOL):
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.16.0
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.19.0

qc: $(LINT_TOOL)
$(LINT_TOOL) run --config=.golangci.yaml ./...
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ database migration tool.
![Schema Diagram](assets/images/schema.png)

## API Endpoints

API endpoints live at /api/docs

## Database Migration
Expand Down
4 changes: 2 additions & 2 deletions db/db/migrations/20191003063231_initial.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ create table transactions

transaction_category text,
external_transaction_id text,
running_balance decimal NOT NULL,
running_balance integer NOT NULL,
metadata json,

created_at int8 NOT NULL DEFAULT extract(epoch from now()),
Expand All @@ -79,7 +79,7 @@ create table line_items
id uuid NOT NULL DEFAULT gen_random_uuid(),
transaction_id uuid NOT NULL REFERENCES transactions(id) ON DELETE CASCADE,

amount decimal NOT NULL,
amount integer NOT NULL,
asset_id integer NOT NULL REFERENCES assets(id) ON DELETE CASCADE,
metadata json,

Expand Down
4 changes: 2 additions & 2 deletions db/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ CREATE TABLE public.entities (
CREATE TABLE public.line_items (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
transaction_id uuid NOT NULL,
amount numeric NOT NULL,
amount integer NOT NULL,
asset_id integer NOT NULL,
metadata json,
created_at bigint DEFAULT date_part('epoch'::text, now()) NOT NULL,
Expand All @@ -158,7 +158,7 @@ CREATE TABLE public.transactions (
account_id uuid NOT NULL,
transaction_category text,
external_transaction_id text,
running_balance numeric NOT NULL,
running_balance integer NOT NULL,
metadata json,
created_at bigint DEFAULT date_part('epoch'::text, now()) NOT NULL,
updated_at bigint DEFAULT date_part('epoch'::text, now()) NOT NULL
Expand Down
Loading

0 comments on commit a3d1a12

Please sign in to comment.