Skip to content

Commit

Permalink
Added base project files
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak committed May 6, 2020
0 parents commit 4173c33
Show file tree
Hide file tree
Showing 32 changed files with 2,130 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
GCP_PROJECT=threedotslabs-cloudnative

PORT=3000

FIRESTORE_PROJECT_ID=threedotslabs-cloudnative
FIRESTORE_EMULATOR_HOST=firestore:8787

TRAINER_GRPC_ADDR=trainer-grpc:3000
USERS_GRPC_ADDR=users-grpc:3000
GRPC_NO_TLS=1

CORS_ALLOWED_ORIGINS=http://localhost:8080

#SERVICE_ACCOUNT_FILE=/service-account-file.json
MOCK_AUTH=true
LOCAL_ENV=true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# this repo is about Go, not JavaScript
*.js linguist-vendored
*.vue linguist-vendored
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Created by .ignore support plugin (hsz.mobi)
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
vendor/

.terraform
*.tfstate
*.tfstate.backup
terraform/.env
terraform/cloud-builders-community

/web/src/repositories/clients/*
!/web/src/repositories/clients/trainer/src/
!/web/src/repositories/clients/trainings/src/
!/web/src/repositories/clients/users/src/

/service-account-file.json
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: openapi
openapi: openapi_http openapi_js

.PHONY: openapi_http
openapi_http:
oapi-codegen -generate types -o internal/trainings/openapi_types.gen.go -package main api/openapi/trainings.yml
oapi-codegen -generate chi-server -o internal/trainings/openapi_api.gen.go -package main api/openapi/trainings.yml

oapi-codegen -generate types -o internal/trainer/openapi_types.gen.go -package main api/openapi/trainer.yml
oapi-codegen -generate chi-server -o internal/trainer/openapi_api.gen.go -package main api/openapi/trainer.yml

oapi-codegen -generate types -o internal/users/openapi_types.gen.go -package main api/openapi/users.yml
oapi-codegen -generate chi-server -o internal/users/openapi_api.gen.go -package main api/openapi/users.yml

.PHONY: openapi_js
openapi_js:
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.3.0 generate \
-i /local/api/openapi/trainings.yml \
-g javascript \
-o /local/web/src/repositories/clients/trainings

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.3.0 generate \
-i /local/api/openapi/trainer.yml \
-g javascript \
-o /local/web/src/repositories/clients/trainer

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.3.0 generate \
-i /local/api/openapi/users.yml \
-g javascript \
-o /local/web/src/repositories/clients/users

.PHONY: proto
proto:
protoc --go_out=plugins=grpc:internal/common/genproto/trainer -I api/protobuf api/protobuf/trainer.proto
protoc --go_out=plugins=grpc:internal/common/genproto/users -I api/protobuf api/protobuf/users.proto

.PHONY: lint
lint:
@./scripts/lint.sh trainer
@./scripts/lint.sh trainings
@./scripts/lint.sh users
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Wild Workouts


### CI Permissions setup

https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-cloud-run
153 changes: 153 additions & 0 deletions api/openapi/trainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Wild Workouts trainer
description: TODO
contact:
name: Three Dots Labs
url: https://threedots.tech/
servers:
- url: https://{hostname}/api
variables:
hostname:
default: localhost
security:
- bearerAuth: []
paths:
/trainer/calendar:
get:
operationId: getTrainerAvailableHours
parameters:
- in: query
name: dateFrom
schema:
type: string
format: date-time
required: true
- in: query
name: dateTo
schema:
type: string
format: date-time
required: true
responses:
'200':
description: todo
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Date'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/trainer/calendar/make-hour-available:
put:
operationId: makeHourAvailable
requestBody:
description: todo
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/HourUpdate'
responses:
'204':
description: todo
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Date'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/trainer/calendar/make-hour-unavailable:
put:
operationId: makeHourUnavailable
requestBody:
description: todo
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/HourUpdate'
responses:
'204':
description: todo
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Date'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Date:
type: object
required: [date, hasFreeHours, hours]
properties:
date:
type: string
format: date
example: "2020-03-22"
hasFreeHours:
type: boolean
hours:
type: array
items:
$ref: '#/components/schemas/Hour'

Hour:
type: object
required: [hour, available, hasTrainingScheduled]
properties:
hour:
type: string
format: date-time
available:
type: boolean
hasTrainingScheduled:
type: boolean

HourUpdate:
type: object
required: [hours]
properties:
hours:
type: array
items:
type: string
format: date-time

Error:
type: object
required:
- slug
- message
properties:
slug:
type: string
message:
type: string
Loading

0 comments on commit 4173c33

Please sign in to comment.