Cada portador de cartão(cliente) possui uma conta com seus dados. A cada operação realizada pelo cliente uma transação é criada e associada a sua respectiva conta. Cada transação possui um tipo(compra á vista, compra parcelada, saque ou pagamento), um valor e uma data de criação. Transações de tipo compra e saque são registradas com valor negativo, enquanto transações de pagamento são registradas com valor positivo.
Rename the file .env.example
to .env
. This file contains the necessary environment variables for the project to run properly.
Build the app and db containers
make app.setup
Start db container
make db.up
Execute migration
make migrate
Run the app
make app.run
Command | Description |
---|---|
app.setup | Build all docker-compose dependencies |
app.run | Start app in dev mode |
app.stop | Stop app container |
db.up | Starts db container |
migrate | Executes database migrations |
swagger | Creates/updates swagger documentation |
generate | Creates/updates mock files |
test | Run tests |
test-coverage | Run testes and outputs coverage file |
http://localhost:8000/swagger/index.html
Here you can download the collection and import to the Postman client
In order to facilitate the development cycle, it was chosen to use reflex on the dev Dockerfile. This way, any changes made to source code can be tested imediatelly, without the need to rebuild the application.
With the intention to enable thorough testing and all the goodies of clean arch, the repositories and packages are referenced by their respective interfaces on the structs that make use of them.
The application is seperated in layers, this way any change in database, framework or any other external agent can be dealt with without major changes to the project.
As a dependency injection solution, the project uses uber-fx.
├── api
│ ├── handler
├── cmd
├── docs
├── internal
│ ├── account
│ ├── transaction
├── migrations
├── pkg
│ ├── clock
│ ├── database
├── .env.example
├── .gitignore
├── build.sh
├── docker-compose.yml
├── Dockerfile
├── go.mod
├── Makefile
├── README.md
└── reflex.conf