- Generate SQL CRUD with sqlc:
make sqlc
- Generate DB mock with gomock:
make mock
-
Setup config parameters in app.env.
-
Generate SQL CRUD with sqlc:
make sqlc
- Run docker-compose:
docker-compose up
- Make migrations:
make migrateup
- Use curl examples to test api. Create new user account first, then perform operations.
- Run test:
make createtestdb
make migratetestup
make test
Create account
curl -d '{"owner":"test user 1", "currency":"USD"}' -H "Content-Type: application/json" -X POST http://wallet.app.loc:8080/accounts
Deposit Operation
curl -d '{"user_id":1, "amount":200, "currency":"USD", "description": "add some money"}' -H "Content-Type: application/json" -X POST http://wallet.app.loc:8080/deposits
Withdrawal Operation
curl -d '{"user_id":1, "amount":20, "currency":"USD", "description": "withdrawal operation"}' -H "Content-Type: application/json" -X POST http://wallet.app.loc:8080/withdrawals
Get balance (GET request - /balance/{user_id})
curl -X GET http://wallet.app.loc:8080/balance/1
Get list of transactions
curl -X GET "http://wallet.app.loc:8080/transactions?start_date=2021-01-01&stop_date=2021-07-19&page_id=1&page_size=10"