ideafast / middleware-services

Python API containing endpoints for smartphone hub applications and transfer to data portal
0 stars 0 forks source link

Added poetry as depdendency manager & serve enveloped data #1

Closed jawrainey closed 4 years ago

jawrainey commented 4 years ago

Overview

Added poetry as a dependency manager for the consumer app, and implemented endpoints to mirror intended usage in the app. I have also added a custom response such that all successfull responses are envloped as follows:

{
   "data": {} (or None),
   "meta: {
       "success": true/false,
       "errors": []
    }
}

This simplifies how clients can integrate with the API as:

  1. All expected data will be in data otherwise it will be None/null
  2. Clients can use meta.success to verify responses to simplify logic on their end vs comparing with response codes.
  3. errors will contain a list of error codes to provide to clients, e.g. [VERIFY_TOKEN_404].

Note: The implementation details for errors requires overriding all HTTPExceptions and will be implemented in a seperate PR. Error handling will be implemented in another PR for simplicity and means we can start using this for local development, hence errors being empty by default.

How to Review Changes?

  1. Verify poetry works: follow the README to run the app via poetry locally
  2. Verify implementation works: Visit the swagger documentation and verify that the endpoints return mock data in the implemented envelope