At Zero Waste Kitchen we're here to combat the growing problem of food waste in the United States. American households generate an estimated 42 billion pounds of food waste each year. This is enough food to feed 21 million people each year.
The consequences of this waste not only has a direct impact on people but far reaching effects for the planet. 96% of this waste ends up in the landfill - resulting in roughly 12 Million Tons of CO2 emissions. That amount of emissions is equivalent to powering 1.5 million homes for a year, or driving a car 2.6 million miles.
Our app is aimed at helping people eliminate food waste in their homes by providing recipes based on ingredients that will soon spoil and contribute to food waste. We hope to inspire users to waste less, save more and have an increased awareness around their personal impact and ability to contribute by having a Zero Waste Kitchen.
- K.D Hubbard | LinkedIn | | Github |
- Boston Lowrey | LinkedIn | | Github |
- Michael Callahan | LinkedIn | | Github |
- Matthew William Johnson | LinkedIn | | Github |
In your terminal run the following commands to clone the repositories:
Frontend
git clone [email protected]:calforcal/fe_zero_waste_kitchen.git
Backend
git clone [email protected]:calforcal/be_zero_waste_kitchen.git
Installing the Gems Locally
bundle install
Front API Keys Needed
Both of these keys will need to be requested from an Admin (see above)
GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
ZWK_API_KEY
Backend API Keys Needed
- NUTRITION_API_KEY: API Ninjas
- EMISSIONS_API_KEY: ClimatIQ
- SPOON-KEY: Spoonacular
- NX_APP_ID: Nutronix
- NX_APP_KEY: Nutronix
- BACKEND_API_KEY: Request From Admin
Installing Figaro
In your terminal run:
bundle exec figaro install
In the new file config/application.yml
Post your keys as they are listed above in this file, for both frontend and backend.
Testing the Repositories
Start up BOTH Servers (Frontend / Backend) by running the following command in each terminal:
rails s
To run the full test suite:
bundle exec rspec
t.string "name"
t.float "units"
t.string "unit_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "recipe_id", null: false
t.bigint "ingredient_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["ingredient_id"], name: "index_recipe_ingredients_on_ingredient_id"
t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id"
t.string "name"
t.string "instructions", default: [], array: true
t.string "image_url"
t.integer "cook_time"
t.boolean "public_status", default: true
t.string "source_name"
t.string "source_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "user_submitted"
t.string "api_id"
t.bigint "user_id", null: false
t.string "ingredient_name"
t.string "unit_type"
t.float "units"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_saved_ingredients_on_user_id"
t.bigint "user_id", null: false
t.bigint "recipe_id", null: false
t.integer "num_stars"
t.boolean "cook_status"
t.boolean "saved_status"
t.boolean "is_owner"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["recipe_id"], name: "index_user_recipes_on_recipe_id"
t.index ["user_id"], name: "index_user_recipes_on_user_id"
t.string "uid"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
add_foreign_key "recipe_ingredients", "ingredients"
add_foreign_key "recipe_ingredients", "recipes"
add_foreign_key "saved_ingredients", "users"
add_foreign_key "user_recipes", "recipes"
add_foreign_key "user_recipes", "users"
GET '/api/v1/users/:id’
Example response of the User resource
{
"data": {
"id": "integer",
"type": "string",
"attributes": {
"uid": "string",
"name": "string",
"email": "string",
"stats": {
"lions_saved": "integer",
"recipes_cooked": "integer",
"recipes_created": "integer"
}
"cooked_recipes": [
{
"name": "string",
"api_id": "string",
"id": "integer"
}
]
"created_recipes": [
{
"name": "string",
"api_id": "string",
"id": "integer"
}
]
"saved_recipes": [
{
"name": "string",
"api_id": "string",
"id": "integer"
}
]
"num_cooked_recipes": "integer",
"num_created_recipes": "integer",
"num_saved_recipes": "integer"
}
}
}
POST '/api/v1/users’
Example of the body details to be provided when creating a user
{
"uid": "string"
}
POST ‘/api/v1/user/:user_id/recipes’
Example of the body details to be provided when creating a recipe
{
"name": "string",
"instructions": "array",
"image_url": "string",
"cook_time": "string",
"public_status": "boolean",
"source_name": "string",
"source_url": "string",
"user_submitted": "boolean",
"api_id": "string",
"uid": "string",
"ingredients": [
{
"name": "string",
"units": "float",
"unit_type": "string"
},
{
"name": "string",
"units": "float",
"unit_type": "string"
}
]
}
POST ‘/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when creating a cooked recipe
{
"uid": "string",
"recipe_id": "integer",
"api_id": "string",
"cook_status": "boolean"
}
POST ‘/api/v1/user/:user_id/ingredients’
Example of the body details to be provided when creating a saved recipe
{
"uid": "string",
"ingredients: [
{
"ingredient_name": "string",
"units": "float",
"unit_type": "string"
}
]
}
POST ‘/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when creating a saved recipe
{
"uid": "integer",
"recipe_id": "integer",
"api_id": "string",
"saved_status": "boolean"
}
POST ‘/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when creating a saved recipe. (Ratings are 1-5)
{
"uid": "string",
"recipe_id": "integer",
"api_id": "string",
"num_stars": "integer"
}
PATCH ‘/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when updating (rating) a cooked recipe
{
"uid": "string",
"recipe_id": "integer",
"api_id": "string",
"cook_status": "boolean",
"num_stars": "integer"
}
PATCH '/api/v1/users/:id’
Example of the body details to be provided when updating a user
{
"uid": "string",
"name": "string",
"email": "string"
}
GET '/api/v1/recipes/:id'
Example response of a Recipes resource
{
"id": "integer",
"type": "string",
"attributes": {
"image_url": "string",
"name": "string",
"rating_from_api": "float",
"cook_time": "integer",
"public_status": "boolean",
"ingredients": [
{
"name": "string",
"units": "float",
"unit_type": "string"
},
{
"name": "string",
"units": "float",
"unit_type": "string"
}
],
"source_name": "string",
"source_url": "string",
"instructions": ["string", "string", ...]
}
}
PATCH '/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when updating a recipe
{
"user_id": "integer",
"recipe_id": "integer",
"name": "string",
"cook_time": "integer",
"source_name": "string"
}
DELETE '/api/v1/user/:user_id/recipes/:recipe_id’
Example of the body details to be provided when deleting a recipe
{
"uid": "string",
"recipe_id": "integer"
}
GET '/api/v1/users/:id/chefs’
Example response of the Users Chefs resource
{
"data": [
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
"username": "string"
},
},
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
"username": "string"
}
}]
}
GET '/api/v1/ingredients'
Example response of the Ingredients resource
{
"data": [
{
"name": "string"
},
{
"name": "string"
},
{
"name": "string"
}
]
}
GET ‘/api/v1/recipes/search?search=query%string’
Example of a response from the Search (by name) resource
{
"data": [
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
}
},
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
}
}
]
}
GET ‘/api/v1/recipes/search?ingredients=query%string,+query’
Example of a response from the Search (by ingredients(s) ) resource
{
"data": [
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
}
},
{
"id": "string",
"type": "string",
"attributes": {
"name": "string",
}
}
]
}