Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supwr/transactions-challenge
Transaction API
https://github.com/supwr/transactions-challenge
gin go gorm reflex uber-fx
Last synced: about 18 hours ago
JSON representation
Transaction API
- Host: GitHub
- URL: https://github.com/supwr/transactions-challenge
- Owner: supwr
- Created: 2024-02-27T17:17:13.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-04-26T18:57:51.000Z (7 months ago)
- Last Synced: 2024-06-19T23:03:36.828Z (5 months ago)
- Topics: gin, go, gorm, reflex, uber-fx
- Language: Go
- Homepage:
- Size: 132 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rotina de transações
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**.## Setting up the project
### Step 1
Rename the file `.env.example` to `.env`. This file contains the necessary environment variables for the project to run properly.### Step 2
Build the app and db containers```sh
make app.setup
```### Step 3
Start db container```sh
make db.up
```### Step 4
Execute migration```sh
make migrate
```### Step 5
Run the app```sh
make app.run
```## Makefile commands
| 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|## Swagger
```
http://localhost:8000/swagger/index.html
```## Postman
[Here](postman_collection.json) you can download the collection and import to the Postman client## Architecture and design decisions
In order to facilitate the development cycle, it was chosen to use **[reflex](https://github.com/cespare/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](https://github.com/uber-go/fx)**.
## Project structure
```
├── 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
```