The code was designed to have clear responsibilities and to be easy to test and mock. I developed it guided to interfaces.
Here is the brain, the core use cases is written here. Files here will be responsible for use cases like: Create a Transaction and an Account
Where I store the transactionsController and accountsController. Their responsibility is to get a request, call a service and return a response to the client.
A model is a structure that shapes the data. It defines the column attributes and it is used for migrations. I don't store any business logic here
Here I'm storing some structs that will make the queries in the DB. Create, Update, Delete and Find queries are wrapped inside it. This way my service doesn't need to know which adapter is being used (postgres, mysql, mongo, etc...)
$ git pull https://github.com/emmanuelperotto/transactions.git
$ cd pismo-test
$ docker-compose up --build
$ go test -coverprofile=coverage.out -v ./...
$ go tool cover -html=coverage.out