Skip to content

Django Rest API from an online challenge. Deployed with Docker compose (Nginx, Django, and Postgres).

Notifications You must be signed in to change notification settings

wanpdsantos/backend_challenge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

About

Rest API developed with Django/Postgres/Nginx and Docker containers.

Instructions

Make sure to have docker installed on your machine.

  1. Clone this repo.
  2. Navigate to the solutions folder and run docker compose up.
  3. The API will be available locally at 127.0.0.1:8080

Environment variables were also commited to make easier to clone and run.

Postman collection is also avaliable in repo so you can import the file to your postman and perform API requests.

Backend Developer Challenge

This is a simple challenge to test your skills on building APIs and your logic. It has to be done using Python and Django/Django Rest Framework

What to do

Create a Rest API that controls a car maintenance status, and the trips it performs. Note that, each litre of gas can run 8 KM and every 3 KM the tyres degrades by 1%.

Objects:

  • Tyre -- Should have its degradation status in %
  • Car -- Should have 4 tyres -- Should have its total gas capacity in liter -- Should have its current gas count in %

Actions:

  • Trip -- Input: car, distance (in KM) -- Output: Complete car status on trip end

  • Refuel -- Input: car, gas quantity (in Litre) -- Output: Final car gas count in %

  • Maintenance -- Input: car, part to replace -- Output: Complete car status

  • CreateCar -- Input: None -- Output: Complete car status

  • GetCarStatus -- Input: car -- Output: Complete car status

  • CreateTyre -- Input: car -- Output: The created tyre

Restrictions:

  • The car should NOT have more than 4 tyres in use
  • The car should NOT be refueled before it has less than 5% gas on tank
  • A car's tyre should NOT be swapped before it hits more than 94% degradation
  • A tyre should NOT be created while there is 4 usable tyres with less than 95% degradation
  • The car cannot travel without gas or one of its tyres

Challenge

  • Write an algorithm in the form of UnitTest that runs a trip of 10.000 KM, without breaking any part or swapping cars or gets out of gas.
  • Document your project, with instructions on how to setup and run a working example.

Recommendations

  • SOLID / DRY

About

Django Rest API from an online challenge. Deployed with Docker compose (Nginx, Django, and Postgres).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.0%
  • Dockerfile 8.2%
  • Shell 0.8%