Coder Social home page Coder Social logo

bangazon-api-jeaninebeckle's Introduction

Bangazon Platform API

Prerequisites

Mac OS

brew install libtiff libjpeg webp little-cms2

Linux (WSL)

sudo apt-get install libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev \
    libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk \
    libharfbuzz-dev libfribidi-dev libxcb1-dev

Install apidoc

npm install apidoc -g

Setup

  1. Clone this repository and change to the directory in the terminal.
  2. Run pipenv shell
  3. Run pipenv install
  4. Type this exact thing into the terminal to run the migrations and seed the database: ./seed_data.sh

Now that your database is set up all you have to do is run the command:

python manage.py runserver

Bangazon ERD

Open the Bangazon database diagram in the browser to view the tables and relationships for your database. Note that the tables names and field names are written in Pascal case, and not in snake case. Your database has everything in snake case, so while the field names are different, the resources and relationships are identical to the ERD.

Postman Request Collection

  1. Open Postman
  2. Click Import from the navbar
  3. Choose the Link option
  4. Paste in this URL: https://www.getpostman.com/collections/c29b98258d312bf240b7
  5. Your should be prompted to import Bangazon Python API.
  6. Click the Import button to complete the process.

To test it out, expand the Profile sub-collection, double-click on Login and send the request. You should get a response back that looks like this.

{
    "valid": true,
    "token": "9ba45f09651c5b0c404f37a2d2572c026c146690",
    "id": 5
}

Documentation

To view browser-based documentation for the project, follow these steps.

  1. Run ./renderdocs.sh
  2. cd docs
  3. Then start a simple web server like http-server or serve.
  4. In your web browser, go to the URL provided by your web server.

documentation site

bangazon-api-jeaninebeckle's People

Contributors

jeaninebeckle avatar github-classroom[bot] avatar

Watchers

James Cloos avatar Hannah Hall avatar

bangazon-api-jeaninebeckle's Issues

TEST: Complete order by adding payment type

Add an integration test to tests/order.py that tests adding a payment type to an order.

  1. Create a payment type in setup
  2. Perform PUT to an order with the payment type id in the request body
  3. Perform GET to the order to verify the payment type is assigned

Same user profile always returned

When an authenticated client submits a GET request to the /profile resource, an incorrect user profile is returned. Additionally, the same user profile is returned regardless of the authentication token provided.

User can like or dislike products

Given the user is authenticated
When the client performs a POST operation to the /products/n/like URL
Then that preference should be created for the current user

Given the user is authenticated
When the client performs a DELETE operation to the /products/n/like URL
Then that preference should be removed for the current user

Given the user is authenticated
When the client performs a GET operation to the /products/liked URL
Then the response should contain a list of products liked by the user

All payment types are being returned

When the client performs a GET request to the /paymenttypes resources, only the payment types added by the authenticated user should be returned.

Currently, all payment types in the system are being returned.

Can't remove an item from the cart

Customers are complaining that they can't remove an item from the cart after it has been added.

When the client performs a DELETE request to the /lineitems/n resource, it should remove the specified item from the user's cart.

TEST: Delete product

Write a new test in the tests/product.py module that verifies that a product can be deleted and not shown to users.

Products keep getting added to the last, closed order

Steps to reproduce.

  1. Authenticate the client and get a token
  2. Create a payment type
  3. Add a product to the cart by sending a POST request to http://localhost:8000/profile/cart
  4. Finish the order by sending a PUT request to the order's URL
  5. Add a product to the cart by sending a POST request to http://localhost:8000/profile/cart

At this point, the product is being related to the completed order instead of a new one being generated.

REPORT: Completed orders

As a business analyst, I would like to see an HTML report showing all orders that have been paid for.

  • Order Id
  • Customer name
  • Total paid for the order
  • Payment type

Cart resource has duplicate line items

When a client requests the /profile/cart resource, the following two keys are on the response object.

  1. lineitems
  2. line_items

The line_items key needs to be removed from the response.

REPORT: Expensive products

As a business aanalyst, I would like to see an HTML report showing all products priced at $1000 or more

REPORT: Incomplete orders

As a business analyst, I would like to see an HTML report showing all orders that have not been paid for yet.

  • Order Id
  • Customer name
  • Total cost of all items on the order

Users can favorite a seller

Given a user wants to view all products being sold by another user
When the client performs a POST request to /profile/favoritesellers
Then the seller will be added to the current user's favorites list

The id of the seller to be favorited should be in the request body.

{
   "seller": 3
}

Increase maximum possible price

The system currently will reject any product being created with a price greater than $10,000. Increase that maximum to $17,500.

REPORT: Favorited sellers by customer

As a business analyst, I would like to see an HTML report showing all users that have favorited a seller, including the favorited sellers.

  • Customer name header
  • Bulleted list of seller names

Division by zero error on products

CRITICAL ISSUE

When the client requests a single product, or all products, the status code is 500 and the response is always the following.

ZeroDivisionError at /products
division by zero

The most recent feature added by the team was adding an average rating key to each product. You might want to start there and see if there are any try/catch blocks you can implement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.