Ethan-t-n / Heat-Check-BE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README For:

Project Overview

๐Ÿ”ฅ Heat Check ๐Ÿ”ฅ is an app that helps spicy food lovers to explore restaurants that have an appropriate spice level to match. It allows users to search for restaurants with spicy dishes, add new dishes, review them, and rate their spiciness level.

๐Ÿ”ฅ Check out the front-end repo here

๐Ÿ”ฅ Visit our application website here

๐Ÿ”ฅ Built With







๐Ÿ”ฅ Schema

Screen Shot 2022-10-24 at 9 50 38 AM

๐Ÿ”ฅ API Endpoints

The following endpoints are exposed, and all endpoints begin with this base URL: https://heatcheck-be.herokuapp.com/ , and all Graphql endpoints respond to POST /graphql requests only. Query information will need to be sent in the body of the request.

RESTAURANTS by LOCATION:

query Restaurants($location: String! ) {
  restaurants(location: $location) {
    id
    name
    rating
    address
    lat
    lon
    city
  }
}

RESTAURANT and its DISHES by YELP ID:

query Restaurant($yelp_id: String! ) {
  restaurant(id: $yelp_id) {
    id
    name
    rating
    price
    imageUrl
    url
    categories
    address
    phone
    lat
    lon
    city
    dishes {
      id
      name
      cuisineType
      yelpId
      spiceRating
      }
    }
  }

ALL USERS:

query {
  users {
    id
    email
    username
  }
}

USER by ID:

query User($id: String! ) {
  user(id: $id) {
    id
    email
    username
  }
}

USER and its REVIEWS by ID:

query User($id: String! ) {
  user(id: $id) {
    id
    email
    username
    reviews {
          id
          description
          overallRating
          userId
          dishId
    }
  }
}

ALL DISHES:

query {
  dishes {
    id
    name
    cuisineType
    yelpId
    spiceRating
  }
}

DISH by ID:

query Dish($id: String! ) {
  user(id: $id) {
    id
    name
    cuisineType
    yelpId
    spiceRating
  }
}

DISH and its REVIEWS by ID:

query Dish($id: String! ) {
  dish(id: $id) {
    id
    name
    cuisineType
    yelpId
    spiceRating
    reviews {
          id
          description
          overallRating
          userId
          dishId
    }
  }
}

ALL REVIEWS:

query {
  reviews {
    id
    description
    overallRating
    userId
    dishId
  }
}

REVIEW by ID:

query Review($id: String! ) {
  user(id: $id) {
    id
    description
    overallRating
    userId
    dishId
  }
}

CREATE USER:

mutation {
  user: createUser(
    input: {
      email: "hello@hello.com"
      username: "hello"
    }
  ) {
    email
    username
    }
  }

UPDATE USER:

mutation {
  user: updateUser(
    input: {
      id: "$id"
      username: "superphil"
      email: "phil@phil.com"
    }
    ) {
      username
      email
  }
}

DELETE USER:

mutation {
  user: deleteUser(
    input: {
      id: "$id"
    }
    ) {
      id
    }
  }

CREATE DISH:

mutation {
  dish: createDish(
    input: {
      name: "Pad Thai"
      cuisineType: "Thai"
      yelpId: "123"
      spiceRating: 2
    }
  ) {
    name
    cuisineType
    yelpId
    spiceRating
  }
}

UPDATE DISH:

mutation {
  dish: updateDish(
    input: {
      id: "$id"
      name: "Super Spicy Pad Thai"
      cuisineType: "Thai"
      yelpId: "1"
      spiceRating: 9
    }
  ) {
    id
    name
    cuisineType
    yelpId
    spiceRating
  }
}

DELETE DISH:

mutation {
  dish: deleteDish(
    input: {
      id: "$id"
    }
  ) {
    id
  }
}

CREATE REVIEW:

mutation {
  review: createReview(
    input: {
      description: "yummers"
      overallRating: 4
      userId: "$user_id"
      dishId: "$dish_id"
    }
) {
    description
    overallRating
    userId
    dishId
  }
}

UPDATE REVIEW:

mutation {
  review: updateReview(
    input: {
      description: "eh, actually its not great"
      overallRating: 2
      id: "$id"
    }
) {
    description
    overallRating
    id
  }
}

DELETE REVIEW:

mutation {
  review: deleteReview(
    input: {
      id: "$id"
    }
) {
    id
  }
}

Example of a graphql call to BE that will pull up a restaurant, its dishes, and all associates reviews all at once:

{
  restaurant(id: "OT6MJNr8Gzd9nyf25dEl6g") {
    id
    name
    rating
    price
    imageUrl
    url
    categories
    address
    phone
    lat
    lon
    city
    dishes {
      id
      name
      cuisineType
      yelpId
      spiceRating
      reviews {
          id
          description
          overallRating
          userId
          dishId
      }
      }
    }
  }

Hereโ€™s an endpoint for the dishes with the highest spiceRating:

{ hottestDishes(amt: -number-) {
                id
                name
                cuisineType
                yelpId
                spiceRating
            }
          } (

๐Ÿ”ฅ Local Setup

  1. Fork and clone the repo to your local machine with SSH: git clone git@github.com:HeatChecc/Heat-Check-BE.git

2 .Register for external API keys:

  1. Install gems and dependencies: bundle install
  2. Configure API keys by running bundle exec figaro install and then adding keys to application.yml file:
  • yelp_token: your_key_here
  1. Set up database: rails db:{drop,create,migrate,seed}
  2. Run test suite: bundle exec rspec
  3. Start up your local server: rails s
  4. Visit the endpoint url http://localhost:3000/graphiql to consume the API locally.

๐Ÿ”ฅ Contributors

Back-End Team

๐ŸŒถ Phillip Stewart ๐ŸŒถ

GitHub Badge Linkedin Badge

๐ŸŒถ Eli Sachs ๐ŸŒถ

GitHub Badge Linkedin Badge

๐ŸŒถ Gauri Joshi ๐ŸŒถ

GitHub Badge Linkedin Badge

๐ŸŒถ Ethan Nguyen ๐ŸŒถ

GitHub Badge Linkedin Badge

Front-End Team

๐ŸŒถ David Daw ๐ŸŒถ

GitHub Badge Linkedin Badge

๐ŸŒถ Ivy Nguyen ๐ŸŒถ

GitHub Badge Linkedin Badge

๐ŸŒถ Cleveland Ticoalu ๐ŸŒถ

GitHub Badge Linkedin Badge

About


Languages

Language:Ruby 93.8%Language:HTML 4.6%Language:JavaScript 1.0%Language:CSS 0.6%