Skip to content

LucasGasque/bluestorm_test

Repository files navigation

Test for Bluestorm selection process

✅ Project Description

Fastapi private REST API that aloes a financial sector to access information about patients, pharmacies and transactions between those.

✅ Features

  • Protected API, that requires JWT to make requests
  • Unit tests to check routes and token validation
  • Can be ran on containers

✅ How to run the app

You can run this API with docker, by using the command, this will create a local container with a connection to port 8000

  docker compose up

You can also run this app locally, you need python 3.10, and run the commands bellow:

create a virtual environment:

  python -m venv venv

activate your virtual environment:

  activate venv/bin/activate

install requirements:

  pip install -r requirments.txt

run main file:

  uvicorn app.main:app --reload

✅ Routes

You can enter your localhost:8000/docs after running your app to check swagger generated API docs

User routes

POST create user

  url/users
body
  {
		"username": "john"
		"password": "securepassword"
	}

POST login

  url/login
form data
  {
		"username": "john"
		"password": "securepassword"
	}
response body
{
  "access_token": "token string",
  "token_type": "bearer"
}

Protected routes

header with token:

{
  "Authorization": "Bearer tokenstring" 
}

Patients

Get list of patients

  url/patients

filters

you can pass first_name and last_name as query strings to filter results
  url/patients?first_name=string&last_name=string
response body
[
  {
    "uuid": "PATIENT0001",
    "first_name": "JOANA",
    "last_name": "SILVA",
    "date_of_birth": "1996-10-25T00:00:00"
  }
]

Pharmacies

Get list of pharmacies

  url/pharmacies
response body
[
	{
    "uuid": "PHARM0001",
    "name": "DROGA MAIS",
    "city": "RIBEIRAO PRETO"
	}
]

Transactions

Get list of Transactions

  url/transactions
response body
[
	{
    "uuid": "TRAN0001",
    "patient_uuid": "PATIENT0045",
    "pharmacy_uuid": "PHARM0008",
    "amount": 3,
    "timestamp": "2020-02-05T07:49:03"
	}
]

✅ Project status

🚀 Concluded 🚀

🖥️ Dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages