A code assignment for Hivery job interview https://github.com/joaosgreccia/hivery-backend-challenge
This program requires Python 3.5 or above to run.
-
Some requirements:
Install pip, if you don't already have:
easy_install pip
Install virtualenv if you don't already have
pip3 install virtualenv
-
Choose a folder to install Paranuara. Create and activate new virtualenv.
On Unix:
virtualenv myenv source myenv/bin/activate
On Windows:
virtualenv myenv myenv\scripts\activate
-
Install Paranuara
pip install https://github.com/govorunov/paranuara/archive/master.zip
This will add
paranuara
command to the console, which offers same syntax one could expect frompython manage.py
script. -
Run these commands to instantiate new paranuara application:
paranuara migrate paranuara loaddata assignment paranuara runserver
Then navigate to http://localhost:8000
-
To wipe database and import new JSON data use following commands:
paranuara flush paranuara load_companies companies.json paranuara load_people people.json
Where
companies.json
andpeople.json
are locations to JSON files containing new data to import. JSON files should be in the format specified in the original assignment. -
To run tests:
paranuara test paranuara
-
http://localhost:8000/api/employees/1/
Given a company (index), returns all its employees. Where
1
is index of the company as specified in source data. -
http://localhost:8000/api/twopeople/1/2/
Given 2 people, provides their information (Name, Age, Address, phone) and the list of their friends in common which have brown eyes and are still alive. Where
1
and2
are indexes of people as specified in source data. -
http://localhost:8000/api/fruits_and_vegetables/1/
Given 1 person, provides a list of fruits and vegetables they like. This endpoint respects this interface for the output:
{"username": "Ahi", "age": "30", "fruits": ["banana", "apple"], "vegetables": ["beetroot", "lettuce"]}