https://github.com/aledsz/bankex
Your Bank with Elixir
https://github.com/aledsz/bankex
Last synced: 4 months ago
JSON representation
Your Bank with Elixir
- Host: GitHub
- URL: https://github.com/aledsz/bankex
- Owner: aleDsz
- Created: 2020-07-25T15:34:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-27T06:22:08.000Z (almost 5 years ago)
- Last Synced: 2025-02-23T05:30:37.719Z (4 months ago)
- Language: Elixir
- Size: 84 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BankEx
## Installation
To install our application, you can run `docker-compose` to it:
```sh
# Start all applications
$ docker-compose up --build
```## Business Logic
To create a new user, you can send the parameters:
```sh
$ curl \
X POST "http://localhost:4000/users" \
-H "accept: application/json" \
-H "content-type: application/json" \
-d "{ \"birth_date\": \"1996-05-07\", \"city\": \"São Paulo\", \"country\": \"Brazil\", \"cpf\": \"08716310080\", \"email\": \"[email protected]\", \"password\": \"123456\", \"gender\": \"M\", \"name\": \"Alexandre de Souza\", \"state\": \"São Paulo\"}"
```And it will generate the response:
```json
{
"message": "User created successfully",
"referral_code": "44090390"
}
```With this, you can create an user with indication like:
```sh
$ curl \
X POST "http://localhost:4000/users" \
-H "accept: application/json" \
-H "content-type: application/json" \
-d "{ \"birth_date\": \"1996-05-07\", \"city\": \"São Paulo\", \"country\": \"Brazil\", \"cpf\": \"08716310080\", \"email\": \"[email protected]\", \"password\": \"123456\", \"gender\": \"M\", \"name\": \"Alexandre de Souza\", \"state\": \"São Paulo\", \"referral_code\": \"44090390\"}"
```## Documentation
You can access Swagger using the route `http://localhost:4000/docs`, and before that you need to generate Swagger file.
Just run `mix swagger`.
## Development
You need to define the environment variable `DATABASE_URL` with yout database connection string for PostgreSQL:
```sh
$ export DATABASE_URL="postgres://bankex:bankex@database:5432/bankex"
$ iex -S mix phx.server
```## Tests
You can run all tests locally using the command:
```sh
$ mix setup # Create database
$ mix test --trace # Run all tests
$ mix test.watcher --trace # Run all tests with watcher
```## Contributing
To contribute you need to:
1. Fork this repo
2. Create a new branch, i.e.: `feature/awesome-commit`
3. Push your code to your fork
4. Create a pull-request to this repo
5. Await to code review ✨