Skip to content

Bookstore Stock Manager is Flask & SQLAlchemy based REST API designed to import books from Google Books API. Books database can ba managed with standard CRUD operations. API accepts and returns data in JSON format. App was deployed with Heroku.

Notifications You must be signed in to change notification settings

kajarosz/bookstore-stock-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bookstore-stock-manager

Bookstore Stock Manager is Flask & SQLAlchemy based REST API designed to import books from Google Books API. Books database is fueled with Postgres and can be managed with standard CRUD operations. API accepts and returns data in JSON format. App was deployed with Heroku - you can find it HERE.

How to access endpoints?

Below you will find avaiable methods/endpoints and request body examples.

  • POST/import → Import books from Google Books API by author. If book already exists in database (it's veryfied based on Google Books book ID), data will be updated.
{
  "author" : "Pratchett"
}
  • POST/books → Add single custom book to the database
{
  "acquired": true,
  "authors": [
      "Karolina Jarosz"
  ],
  "external_id": null,
  "published_year": "2022",
  "thumbnail": null,
  "title": "How to manage your book store?"
 }
  • GET/api_spec → Basic info about API
  • GET/books?author=Karolina&title=store%from=2003&to=2022&acquired=true → Get books info filtered by author, title, published year tange and acquired status. If no filters are given, API will return list of all books.
  • GET/books/1 → Get single book info for given ID
  • DEL/books/1 → Delete book for given ID
  • PATCH/books/1 → Update book info for given ID
{
  "acquired" : false
}

How to start server locally in development mode?

  1. Fork this repo and clone it to your choosen directory (alternatively you can just download a .zip file and unpack it).
git clone https://github.com/kajarosz/bookstore-stock-manager.git
  1. Install dependencies - required packages are listed in requirements.txt file. You may need to use pip3 instead of just pip.
pip install -r requirements.txt
  1. Inside run_app.py file: set enviroment to development mode & paste your database URI:
ENV = 'dev'

if ENV == 'dev':
    app.debug = True
    app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://username:password@localhost/bookstore'
else:
    app.debug = False
    app.config['SQLALCHEMY_DATABASE_URI'] = ''
  1. Run run_app.py file in Python. You may need to use python3 instead of just python.
python run_app.py

How to run tests?

In project directory run:

pytest

Public APIs used in the project

https://developers.google.com/books/docs/v1/using

About

Bookstore Stock Manager is Flask & SQLAlchemy based REST API designed to import books from Google Books API. Books database can ba managed with standard CRUD operations. API accepts and returns data in JSON format. App was deployed with Heroku.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published