Skip to content

VaniDevs/team20_sushi

Repository files navigation

team20_sushi

Product Database API - [internal source], [external source]
User Database API - [internal source], [external source]


Plastic Karma Product API

Overview

Plastic Karma's REST API is a scaleable, quick, and efficent program. Using MongoDB and their Atlas service for scalable servers, Heroku for scalable Node.js servers, and Express for quick responses and maximum efficiency. The API allows all of our platforms (IOS, Andriod, Websites), to communicate on one centeral database servers. This allows us to just change the one server instead of all of our platforms, allowing increased reliability and ease of use.

Our Product Database is responsible for storing a collection of universal product codes and the corresponding environmental impact data.

Tutorial

Some sample with Postman can be found here.

Deploying

  1. Clone (git clone https://github.com/tokyojack/Plastic-Karma-Product-Rest-API
  2. CD into the folder
  3. Run npm install for the packages
  4. Add your MongoDB atlas URL into the config.js file
  5. Run node index.js to start the server
  6. Start testing it out at localhost:8080

Queries - Products

POST - /product/add - Creates a product

  • UPC - String
  • plastic_score - Integer
  • action_desc - String
  • name - String
  • recyling_score - Integer
  • waste_score - Integer

Example successful response

{
    "message": "Product created successfully"
}

GET - /find/ - Returns info about a product

Example successful response

{
    "_id": "5ba7dd97c7763b001544a16b",
    "upc": "732619602003",
    "plastic_score": 3,
    "action_desc": "refundable",
    "name": "laundry detergent bottle",
    "recycling_score": 2,
    "waste_score": 1,
    "transactions": []
}

GET - /products - Returns all products

Example successful response

[
    {
        "_id": "5ba7db6ec7763b001544a157",
        "upc": "379941575228",
        "plastic_score": 18,
        "action_desc": "recyclable",
        "name": "pizza tray",
        "recycling_score": 17,
        "waste_score": 0,
        "transactions": []
    },
    {
        "_id": "5ba7dc58c7763b001544a15f",
        "upc": "616087993400",
        "plastic_score": 18,
        "action_desc": "recyclable",
        "name": "phone case package",
        "recycling_score": 16,
        "waste_score": 0,
        "transactions": [
            {
                "amount": 2,
                "user_email": "[email protected]",
                "date": "2018-09-23T19:27:55.081Z"
            }
        ]
    }
]

Queries - Transactions

POST - /product/add - Creates a product

  • UPC - String
  • email - String

Example successful response

{
    "message": "Transaction added successfully",
    "score": 1
}

GET - /product/find/ - Finds the transactions for a product

Example successful response

[
    {
        "amount": 34,
        "user_email": "[email protected]",
        "date": "2018-09-23T19:27:55.081Z"
    },
    {
        "amount": 229,
        "user_email": "[email protected]",
        "date": "2018-03-23T13:51:55.081Z"
    }
]


Plastic Karma User Database API

Overview

Plastic Karma's REST API is a scaleable, quick, and efficent program. Using MongoDB and their Atlas service for scalable servers, Heroku for scalable Node.js servers, and Express for quick responses and maximum efficiency. The API allows all of our platforms (IOS, Andriod, Websites), to communicate on one centeral database servers. This allows us to just change the one server instead of all of our platforms, allowing increased reliability and ease of use.

Our User Database is responsible for storing a collection of user data and their karma score.

Tutorial

Some sample with Postman can be found here.

Deploying

  1. Clone (git clone https://github.com/tokyojack/Plastic-Karma-User-Rest-API
  2. CD into the folder
  3. Run npm install for the packages
  4. Add your MongoDB atlas URL into the config.js file
  5. Run node index.js to start the server
  6. Start testing it out at localhost:8080

Queries

POST - /add - Creates a product

  • email - String
  • password - Integer
  • current_score - String
  • waste_score - String
  • prior_month_score - Integer

Example successful response

{
    "message": "User created successfully"
}

GET - /find/ - Returns info about a product

Example successful response

{
    "_id": "5ba7b8102071244568b9b126",
    "email": "[email protected]",
    "password": "asd123",
    "current_score": 0,
    "waste_score": 0,
    "prior_month_score": 0
}

POST - /increasescore - Increases a users score

  • email - String
  • amount - Integer

Example successful response

{
    "message": "Score added successfully",
    "score": 30
}

Support

For support, simply just email us at [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages