git clone https://github.com/cardosorrenan/desafio-dev
cd desafio_dev/my_logbook/
docker-compose up --build -d
- Upload the CNAB file at http://localhost:8000/upload_cnab
- Check your transactions at http://localhost:8000
sudo service postgresql start
sudo -i -u postgres
psql
CREATE DATABASE mylogbook;
CREATE USER mylogbook_user WITH ENCRYPTED PASSWORD 'mylogbook_pass';
GRANT ALL PRIVILEGES ON DATABASE mylogbook TO mylogbook_user;
ALTER USER mylogbook_user CREATEDB;
exit;
pip3 install virtualenv
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
./manage.py create_superuser_test --username superuser_test --password 1234 --noinput --email 'superuser@test.com'
python3 manage.py loaddata app/fixtures/*.json
- Transaction types and a predefined OAuth application provider
python3 manage.py test
python3 manage.py runserver
- Upload the CNAB file at http://localhost:8000/upload_cnab
- Check your transactions at http://localhost:8000
- Download JSON
- Select "file import" in Insomnia
REQUEST
{
"client_secret": "client_secret_test",
"client_id": "client_id_test",
"grant_type": "password",
"username": "superuser_test",
"password": "1234"
}
RESPONSE
{
"access_token": "wS4W3gUdlL2KdMcCQHQBf7W0pTO4sR",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write",
"refresh_token": "jUsEidWSHx2lWSKnCZkZ9juAWsWmxy"
}
REQUEST
{
"client_secret": "client_secret_test",
"client_id": "client_id_test",
"token": "wS4W3gUdlL2KdMcCQHQBf7W0pTO4sR"
}
RESPONSE
200
- Obs.: Use token authorization on every request
Authorization: Bearer <token>
Store {
name: string
owner: string
}
URL | METHOD | BODY | RESPONSE | |
---|---|---|---|---|
INDEX | /api/v1/store | GET | - | Store[ ] |
GET ONE | /api/v1/store/{id} | GET | - | Store |
GET AMOUNT | /api/v1/store/{id}/amount | GET | - | id, amount |
CREATE | /api/v1/store | POST | Store | Store |
EDIT | /api/v1/store/{id} | PATCH | Store | Store |
DELETE | /api/v1/store/{id} | DELETE | - | - |
Transaction {
file_origin: int
type: int
store: int
datetime: datetime
value: decimal
cpf: string
card: string
}
URL | METHOD | BODY | RESPONSE | |
---|---|---|---|---|
INDEX | /api/v1/transaction | GET | - | Transaction[ ] |
GET ONE | /api/v1/transaction/{id} | GET | - | Transaction |
CREATE | /api/v1/transaction | POST | Transaction | Transaction |
EDIT | /api/v1/transaction/{id} | PATCH | Transaction | Transaction |
DELETE | /api/v1/transaction/{id} | DELETE | - | - |
FileOrigin {
filename: string
content_type: string
size: float
entries: int
created_at: datetime
updated_at: datetime
}
URL | METHOD | BODY | RESPONSE | |
---|---|---|---|---|
INDEX | /api/v1/file_origin | GET | - | FileOrigin[ ] |
GET ONE | /api/v1/file_origin/{id} | GET | - | FileOrigin |