Skip to content

rafaelassacconi/work-at-olist

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Olist Library API

This project is a fork from Work at olist project by Olist. It's an application for a library to store book and authors data.

Click here to open a demo of the app on Heroku.

1. Versions

  • Ubuntu 18.04.3
  • Python 3.6.10
  • Django 3.0.5
  • Django Rest Framework 3.11.0

2. Links

3. Modeling

Enhanced entity-relationship (EER) diagram:

ERR Diagram

4. API Endpoints

Author endpoints, more information here.

Method Endpoint Description
GET /v1/authors/ List all of authors
POST /v1/authors/ Creates a new author
GET /v1/authors/{id}/ Retrieves an author details
PUT /v1/authors/{id}/ Updates an author
DELETE /v1/authors/{id}/ Deletes an author

Book endpoints, more information here.

Method Endpoint Description
GET /v1/books/ List all of books
POST /v1/books/ Creates a new book
GET /v1/books/{id}/ Retrieves a book details
PUT /v1/books/{id}/ Updates a book
DELETE /v1/books/{id}/ Deletes a book

5. Running the project

5.1 Virtualenv

Install pip, virtualenv and virtualenvwrapper packages:

sudo apt-get install python3-pip
sudo pip3 install virtualenv virtualenvwrapper

For configure the VirtualEnvWrapper, edit the file /home/user/.bashrc: Include the content bellow at the end of the file:

# Python Virtualenvs 
export WORKON_HOME=/home/user/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
source /usr/local/bin/virtualenvwrapper.sh 
export PIP_REQUIRE_VIRTUALENV=true 

Restart the terminal and run the command bellow to create a virtualenv:

mkvirtualenv olistlibrary

5.2 Prepare the project

Clone this repository and access to the folder:

git clone https://github.com/rafaelassacconi/work-at-olist.git

Activate the virtualenv:

workon olistlibrary

Install the packages required:

pip install -r requirements.txt

Run migrate command to create a database:

olistlibrary/manage.py migrate

Run the command bellow to import authors and books data:

olistlibrary/manage.py import_authors files/authors.csv
olistlibrary/manage.py import_books files/books.csv

5.3 Run the local application

Use the command bellow to execute the application:

olistlibrary/manage.py runserver

Access the application using this link: http://localhost:8000

5.4 Tests

If you want run the tests, use this command bellow:

olistlibrary/manage.py test books

About

Apply for a job at Olist's Development Team: https://olist.gupy.io/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%