Skip to content

itsmehemant7/bookAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Publication - Flask API

This API is developed by using python flask. The key features of this API are :

Features

  • Built with pure python | Flask
  • User authentication
  • CRUD operations for book(s) & user(s)
  • Test implementation with python's pytest
  • In-Built Swagger Documentation

API Reference

User operation(s)

  POST /signup
Parameter Type Description
username string *Required. Username
email string *Required. Email-id
password string *Required. Password
  POST /login
Parameter Type Description
email string *Required. Email-id
password string *Required. Password
  PUT /update-dp
Parameter Type Description
image string($binary) *Required. Image
  PUT /update-user-info
Parameter Type Description
username string *Optional. Username
email string *Optional. Email-id
password string Optional. Password
  GET /user
Parameter Type Description
None None return current user info
  DELETE /delete-user

*Deletes current logged in user account/info from DB.

  GET /logout
Parameter Type Description
None None log out current user

Book Publication operation(s)

  POST /addbook
Parameter Type Description
title string *Required Title of the book
description string *Required Description of the book
priority number *Required Priority of the book
status string *Required Current status of the book
  PUT /updatebook/{id}
Parameter Type Description
title string *Required Title of the book
description string *Required Description of the book
priority number *Required Priority of the book
status string *Required Current status of the book
  GET /getbook/{id}

Returns (example):

{
  "created_at": "2022-08-08 07:50:36.556437",
  "description": "my book description",
  "id": 14,
  "priority": "2",
  "status": "Available",
  "time_since_published": "1:00:47.154837",
  "title": "The gret title",
  "updated_at": "2022-08-08 07:51:46.677554",
  "user": "[email protected]"
}
  DELETE /deletebook/{id}

*Deletes the book from DB (after permission check).

Swagger Documentation

The Swagger API docs for the app can be accessed via

  /api/docs

All the available features can be accessed at Swagge docs.

Running Tests via Pytest

The test_users.py & test_publishers.py files contains all available unit tests

To run tests, use the following steps

  • Steps to run test(s) FOR User and Publication methods/routes:

    STEP-1:
        - start virtualenv and run the app.py (i.e flask app)

    STEP-2:
        - activate the same virtualenv in another shell/cmd window
        - run `pytest -s test_users.py` command
        - the test result(s) will be seen on console with response message(s)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages