An application that allows a user to create meal plans based on their Dietary Restrictions, Intolerances, and Cusine Preferences.
This is the backend service of the application.
Report Bug
·
Request Feature
·
Front End Repo
Table of Contents
At Pantry Wizard, we believe that everyone deserves access to healthy, delicious food. We're on a mission to reduce food waste and alleviate food insecurity by providing personalized meal planning that simplifies the decision-making process and empowers individuals to take control of their nutrition. Our app is designed to meet the needs of neurodivergent individuals, picky eaters, and anyone facing time or resource constraints, so they can focus on what really matters in their lives. Join us in making a positive impact on our communities, one meal at a time.
This is a Ruby on Rails application which establishes API endpoints to be called in the pantry_wizard_fe
repository. To run the application locally, both front-end and back-end repositories will need to be cloned and set up fully with required gems and environment variables.
-
Clone the repo:
git clone git@github.com:pantry-wizard/pantry_wizard_be.git
-
Install gems:
bundle install
-
To establish the database, run:
rails db:create
-
Since this is the back-end repository, a database migration is also necessary, run:
rails db:migrate
Inspect the /db/schema.rb
and compare to the 'Schema' section below to ensure this migration has been done successfully.
Once pantry_wizard_be
is correctly installed, run tests locally to ensure the repository works as intended.
To test the entire RSpec suite, run:
bundle exec rspec
All tests should be passing if the installation was successful.
If any tests are not passing, please report which tests are not passing Here. We will issue an update/fix as soon as possible!
-
This API can be called locally using a program like Postman.
-
Note: Necessary parameters marked with {}
### 1. Create a New User
Note: pass name
, google_id
, & email
in request body
POST '/api/v1/users'
Response:
{
"data":
{
"id":"USER_ID",
"type":"user",
"attributes":
{
"name":"USER_NAME",
"email":"USER_EMAIL",
"google_id":"USER_GOOGLE_ID"
}
}
}
GET '/api/v1/users'
Response:
{
"data": [
{
"id": "USER_ID",
"type": "user",
"attributes": {
"email": "EMAIL",
"name": "NAME",
"google_id": "GOOGLE_ID",
"id": "USER_ID",
"intolerances": "INTOLERANCES",
"likes": "LIKES",
"dislikes": "DISLIKES",
"dietary_restrictions": "DIETARY RESTRICTIONS"
}
}
]
}
GET 'api/v1/users/{google_id}
Response:
{
"data": [
{
"id": "USER_ID",
"type": "user",
"attributes": {
"email": "EMAIL",
"name": "NAME",
"google_id": "GOOGLE_ID",
"id": "USER_ID",
"intolerances": "INTOLERANCES",
"likes": "LIKES",
"dislikes": "DISLIKES",
"dietary_restrictions": "DIETARY RESTRICTIONS"
}
}
]
}
Note: pass updated attributes in request body
PATCH 'api/v1/users/{google_id}
Response:
{
"data": [
{
"id": "USER_ID",
"type": "user",
"attributes": {
"email": "EMAIL",
"name": "NAME",
"google_id": "GOOGLE_ID",
"id": "USER_ID",
"intolerances": "INTOLERANCES",
"likes": "LIKES",
"dislikes": "DISLIKES",
"dietary_restrictions": "DIETARY RESTRICTIONS"
}
}
]
}
DELETE 'api/v1/users/{google_id}'
### 1. Get Day Plans for a User
GET 'api/vi/users/{google_id}/day_plans
Response:
{
"data": [
{
"id": "ID",
"type": "day_plan",
"attributes": {
"user_id": "USER_ID",
"date": "DATE",
"recipes": [
{
"id": "RECIPE_ID",
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE INGREDIENTS",
"instructions": "RECIPE INSTRUCTIONS",
"image": "RECIPE IMAGE",
"created_at": "CREATED_AT",
"updated_at": "UPDATED_AT"
}
]
}
}
]
}
GET 'api/v1/users/{user_id}/day_plans/{day_plan_id}'
Response:
{
"data": [
{
"id": "ID",
"type": "day_plan",
"attributes": {
"user_id": "USER_ID",
"date": "DATE",
"recipes": [
{
"id": "RECIPE_ID",
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE INGREDIENTS",
"instructions": "RECIPE INSTRUCTIONS",
"image": "RECIPE IMAGE",
"created_at": "CREATED_AT",
"updated_at": "UPDATED_AT"
}
]
}
}
]
}
Post '/api/v1/users/{user_id}/day_plans
Response:
{
"data": [
{
"id": "ID",
"type": "day_plan",
"attributes": {
"user_id": "USER_ID",
"date": "DATE",
"recipes": [
{
"id": "RECIPE_ID",
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE INGREDIENTS",
"instructions": "RECIPE INSTRUCTIONS",
"image": "RECIPE IMAGE",
"created_at": "CREATED_AT",
"updated_at": "UPDATED_AT"
}
]
}
}
]
}
Note: pass updated attributes in request body
PATCH '/api/v1/users/{user_id}/day_plans/{day_plan_id}'
Response:
{
"data": [
{
"id": "ID",
"type": "day_plan",
"attributes": {
"user_id": "USER_ID",
"date": "DATE",
"recipes": [
{
"id": "RECIPE_ID",
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE INGREDIENTS",
"instructions": "RECIPE INSTRUCTIONS",
"image": "RECIPE IMAGE",
"created_at": "CREATED_AT",
"updated_at": "UPDATED_AT"
}
]
}
}
]
}
DELETE '/api/v1/users/{user_id}/day_plans/{day_plan_id}
GET '/api/v1/recipes
Response:
{
"data": [
{
"id": "1",
"type": "recipe",
"attributes": {
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE_INGREDIENTS",
"instructions": "RECIPE_INSTRUCTIONS",
"image": "RECIPE_IMAGE"
}
]
}
Post '/api/v1/recipes'
Response:
{
"data": [
{
"id": "1",
"type": "recipe",
"attributes": {
"spoonacular_id": "SPOONACULAR_ID",
"name": "RECIPE_NAME",
"ingredients": "RECIPE_INGREDIENTS",
"instructions": "RECIPE_INSTRUCTIONS",
"image": "RECIPE_IMAGE"
}
]
}
Note: You must pass in a day plan id and recipe id as params(params: { day_plan_id: @day_plan.id, recipe_id: @recipe_1.id })
Post '/api/v1/day_plan_recipes
Response:
{
"data": {
"id": "6",
"type": "day_plan_recipe",
"attributes": {
"day_plan_id": "DAY_PLAN_ID"
"recipe_id": "RECIPE_ID"
}
}
}
Pantry Wizard was crafted to satisfy the requirements for The Turing Back-End Mod 3 group project, Consultancy.
See the official project requirements here.
- Impliment Google OAuth so users can log in easily.
- Impliment CircleCI for continuous integration.
- Utilize Service Oriented Architecture by creating an API with Rails.
- Interact with two unique external API's.
- Deploy both the frontend and backend on Heroku.
- Add google calendar so meals can be scheduled in advance.
- Integrating Swagger.
- Integrating HoneyBadger for observability of backend queries.
- Integrating Swagger to make endpoint testing easier.
Chris Crane | Conner Van Loan | Caleb Thomas | Brian Hayes | Dawson Timmons |
GitHub |
GitHub |
GitHub |
GitHub |
GitHub |