Skip to content

dashprotocol/reviews-service

 
 

Repository files navigation

Restaurant Reviews Service

This is a module that provides reviews, ratings, photos and business comments for restaurants.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Node 6 or above
postgreSQL

Installing

Install node modules and dependencies

npm install

Start the server

npm start 

Access the server at http://localhost:3007/

Built With

  • Webpack 4
  • Babel 7
  • Node.js
  • Express.js
  • postgreSQL
  • NGINX
  • New Relic
  • Loader.io
  • k6

API Documentation

  • URL: /restaurants/:id/reviews
    • Notes: Route to handle retrieving all reviews for a single restaurant
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
reviews = [
  {
    id: integer,
    user_id: integer,
    restaurant_id: integer,
    rating: integer,
    review_date: string,
    review_text: string,
    previous_review: integer
  },
]
  • URL: /restaurant/:restaurant_id/user/:user_id/review
    • Notes: Route to handle adding a new review for a given restaurant
    • Method: POST
    • URL Params: restaurant_id=[integer], user_id=[integer]
    • Request Body:
  {
    user_id: integer,
    restaurant_id: integer,
    rating: integer,
    review_date: string,
    review_text: string,
    previous_review: integer
  }
  • URL: /review/:id
    • Notes: Route to handle updating a given review
    • Method: PATCH
    • URL Params: id=[integer]
    • Request Body:
  {
    rating: integer,
    review_text: string,
    previous_review: integer
  }
  • URL: /review/:id
    • Notes: Route to handle delete a given review
    • Method: DELETE
    • URL Params: id=[integer]
    • Response Body:
  null
  • URL: /user/:id
    • Notes: Route to handle retrieving a given user
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
  {
    id: integer,
    first_name: string,
    last_name: string,
    profile_pic: string,
    profile_url: string,
    city: string,
    state: string,
    creation_date: string,
    friends_count: integer,
    photos_count: integer,
    elite_year: integer
  }
  • URL: /user
    • Notes: Route to handle adding a new user
    • Method: POST
    • URL Params: N/A
    • Request Body:
  {
    name: string,
    profile_pic: string,
    profile_url: string,
    city: string,
    state: string,
    creation_date: string,
    friends_count: integer,
    photos_count: integer,
    elite_year: integer
  }
  • URL: /user/:id
    • Notes: Route to handle updating a given user
    • Method: PATCH
    • URL Params: id=[integer]
    • Request Body:
  {
    firstName: string,
    lastName: string,
    profilePic: string,
    profileUrl: string,
    city: string,
    state: string,
    friendsCount: integer,
    photosCount: integer,
    eliteYear: integer
  }
  • URL: /user/:id
    • Notes: Route to handle deleting a given user
    • Method: DELETE
    • URL Params: id=[integer]
    • Response Body:
  null
  • URL: /review/:id/photos
    • Notes: Route to handle getting all photos for a given review
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
  photos = [
    {
      id: integer,
      user_id: integer,
      review_id: integer,
      photo_url: string,
      photo_text: string
    }
  ]
  • URL: /review/:id/photo
    • Notes: Route to handle adding a photo for a given review
    • Method: POST
    • URL Params: id=[integer]
    • Requst Body:
  {
    user_id: integer,
    review_id: integer,
    photo_url: string,
    photo_text: string
  }
  • URL: /photo/:id
    • Notes: Route to handle updating a photo for a given review
    • Method: PATCH
    • URL Params: id=[integer]
    • Request Body:
    {
      photo_url: string,
      photo_text: string
    }
  • URL: /photo/:id
    • Notes: Route to handle deleting a photo for a given review
    • Method: DELETE
    • URL Params: id=[integer]
    • Response Body:
  null
  • URL: /review/:id/business_reply
    • Notes: Route to handle getting a business reply for a given review
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
    {
      id: integer,
      review_id: integer,
      name: string,
      business_position: string,
      business_avatar: string,
      reply_date: string,
      reply_text: string
    }
  • URL: /review/:id/business_reply
    • Notes: Route to handle adding a business reply for a given review
    • Method: POST
    • URL Params: id=[integer]
    • Request Body:
    {
      review_id: integer,
      name: string,
      business_position: string,
      business_avatar: string,
      reply_date: string,
      reply_text: string
    }
  • URL: /business_reply/:id
    • Notes: Route to handle updating a business reply for a given review
    • Method: PATCH
    • URL Params: id=[integer]
    • Request Body:
    {
      name: string,
      business_position: string,
      business_avatar: string,
      reply_date: string,
      reply_text: string
    }
  • URL: /business_reply/:id
    • Notes: Route to handle deleting a business reply for a given review
    • Method: DELETE
    • URL Params: id=[integer]
    • Response Body:
  null
  • URL: /restaurant/:id
    • Notes: Route to handle getting a restaurant
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
  {
    id: integer,
    name: string,
    address_1: string,
    address_2: string,
    city: string,
    state: string,
    zip: integer,
    review_count: integer,
    cuisine_type: string,
    phone_number: string,
    website: string
  }
  • URL: /restaurant/
    • Notes: Route to handle adding a restaurant
    • Method: POST
    • URL Params: none
    • Request Body:
  {
    name: string,
    address_1: string,
    address_2: string,
    city: string,
    state: string,
    zip: integer,
    review_count: integer,
    cuisine_type: string,
    phone_number: string,
    website: string
  }
  • URL: /restaurant/:id
    • Notes: Route to handle updating a restaurant
    • Method: PUT
    • URL Params: id=[integer]
    • Request Body:
  {
    id: integer,
    name: string,
    address_1: string,
    address_2: string,
    city: string,
    state: string,
    zip: integer,
    review_count: integer,
    cuisine_type: string,
    phone_number: string,
    website: string
  }
  • URL: /restaurant/:id
    • Notes: Route to handle deleting a restaurant
    • Method: DELETE
    • URL Params: id=[integer]
    • Response Body:
  null
  • URL: /review/:id/votes
    • Notes: Route to handle getting all votes for a review
    • Method: GET
    • URL Params: id=[integer]
    • Response Body:
  votes = [
    {
      review_id: integer,
      user_id: integer,
      voted_cool: boolean,
      voted_funny: boolean,
      voted_useful: boolean
    },
  ]
  • URL: /review/:review_id/user/:user_id/votes
    • Notes: Route to handle adding votes from a user for a review
    • Method: POST
    • URL Params: review_id=[integer], user_id=[integer]
    • Request Body:
  {
    review_id: integer,
    user_id: integer,
    voted_cool: boolean,
    voted_funny: boolean,
    voted_useful: boolean
  }
  • URL: /review/:review_id/user/:user_id/votes
    • Notes: Route to handle updating votes from a user for a review
    • Method: PATCH
    • URL Params: review_id=[integer], user_id=[integer]
    • Request Body:
  {
    voted_cool: boolean,
    voted_funny: boolean,
    voted_useful: boolean
  }
  • URL: /review/:review_id/user/:user_id/votes
    • Notes: Route to handle deleting votes from a user for a review
    • Method: DELETE
    • URL Params: review_id=[integer], user_id=[integer]
    • Response Body:
  null
  • URL: /photo/:photo_id/user/:user_id/vote
    • Notes: Route to handle getting a vote from a user for a photo
    • Method: GET
    • URL Params: photo_id=[integer], user_id=[integer]
    • Response Body:
  {
    photo_id: integer,
    user_id: integer,
    voted_helpful: boolean,
    voted_unhelpful: boolean
  }
  • URL: /photo/:photo_id/user/:user_id/vote
    • Notes: Route to handle adding a vote from a user for a photo
    • Method: POST
    • URL Params: photo_id=[integer], user_id=[integer]
    • Request Body:
  {
    photo_id: integer,
    user_id: integer,
    voted_helpful: boolean,
    voted_unhelpful: boolean
  }
  • URL: /photo/:photo_id/user/:user_id/vote
    • Notes: Route to handle updating a vote from a user for a photo
    • Method: PATCH
    • URL Params: photo_id=[integer], user_id=[integer]
    • Request Body:
  {
    voted_helpful: boolean,
    voted_unhelpful: boolean
  }
  • URL: /photo/:photo_id/user/:user_id/votes
    • Notes: Route to handle deleteing votes from a user for a photo
    • Method: DELETE
    • URL Params: photo_id=[integer], user_id=[integer]
    • Response Body:
  null

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%