Coder Social home page Coder Social logo

flair-bnb's Introduction

FlairBnB (AirBnB Clone)

FlairBnB is a simple clone of AirBnB. The site its current state, is used to browse/create listings, and create/browse reviews for listings.

Note: Flairbnb's website has been flagged as "suspicious" by Google, this is a false positive, the site is strictly a clone of Airbnb and does not attempt to phish users.

Site Information

Tech Stack

  • JavaScript
  • Sequelize
  • Express
  • React
  • Redux
  • Heroku PostgreSQL
  • SQLite3 (For Local Testing)

Build Guide

To install locally:

  • Clone the repo to a folder of your choice git clone https://github.com/hazeluwuz/Flair-BnB.git
  • npm install in the backend folder
  • npm install in the frontend folder

Setup/Seed database:

  • Create a .env file in the backend folder with the following data
PORT=<PORT_NUMBER>
DB_FILE=<DB_FILE_LOCATION>
JWT_SECRET=<SECRET_KEY>
JWT_EXPIRES_IN=<EXPIRATION_TIMER>
  • npx dotenv sequelize db:migrate in the backend folder
  • npx dotenv sequelize db:seed:all in the backend folder

Running the app:

  • npm start in the backend folder FIRST
  • npm start in the frontend folder AFTER

Splash Page

image

Spot Detail Page

image

User Listings

image

flair-bnb's People

Contributors

hazeluwuz avatar

Stargazers

andrew kim avatar  avatar

Watchers

 avatar

flair-bnb's Issues

Get all Reviews by a Spot's id (Feature 2)

Returns all the reviews that belong to a spot specified by id.

  • Seed data exists in the database for reviews to be returned.
  • Successful response includes only reviews for the specified spot
  • Review data returned includes the id, userId, spotId, review,
    stars, createdAt, and updatedAt
  • Review data returns associated data for User, including the id,
    firstName, and lastName
  • Review data returns associated data for images, an array of image urls
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Edit a Spot (Feature 1)

Updates and returns an existing spot.

  • An authenticated user is required for a successful response
  • Only the owner of the spot is authorized to edit
  • Spot record is updated in the database after request
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    and updatedAt
  • Error response with status 400 is given when body validations for the
    address, city, state, country, lat, lng, name, description, or price are violated
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Edit a Review (Feature 2)

Update and return an existing review.

  • An authenticated user is required for a successful response
  • Only the owner of the review is authorized to edit
  • Review record is updated in the database after request
  • Review data returned includes the id, userId, spotId, review,
    stars, createdAt, and updatedAt
  • Error response with status 400 is given when body validations for the
    review, or stars are violated
  • Error response with status 404 is given when a review does not exist with
    the provided id

Delete an Image (Feature 4)

Delete an existing image.

  • An authenticated user is required for a successful response
  • Only the owner of the image is authorized to delete
  • Image record is removed from the database after request
  • Success response includes a message indicating a successful deletion
  • Error response with status 404 is given when an image does not exist with
    the provided id

Sign Up a User (Feature 0)

Creates a new user, logs them in as the current user, and returns the current
user's information.

  • New user exists in the database after request
  • Successful response includes newly created id, firstName, lastName,
    email, and token
  • Error response with status 403 is given when the specified email already
    exists
  • Error response with status 400 is given when body validations for the
    email, firstName, or lastName are violated

Get the Current User (Feature 0)

Returns the information about the current user that is logged in.

  • An authenticated user is required for a successful response
  • Successful response includes the user's id, firstName, lastName,
    email, and token

Add an Image to a Review based on the Review's id (Feature 4)

Create and return a new image for a review specified by id.

  • An authenticated user is required for a successful response
  • Only the owner of the review is authorized to add an image
  • New image exists in the database after request
  • Image data returned includes the id, imageableId, imageableType, and
    url
  • Error response with status 404 is given when a review does not exist with
    the provided id
  • Error response with status 400 is given when the maximum number of images
    have been added for the review

Add Query Filters to Get All Spots (Feature 4)

Return spots filtered by query parameters.

  • Query parameters are accepted for page, size, minLat, maxLat,
    minLng, maxLng, minPrice, and maxPrice
  • Default values are provided for the page and size parameters
  • Successful response includes only spots in the database that meet the
    specified query parameters criteria.
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    updatedAt, and previewImage for each spot
  • Successful response includes the page and size of the returned payload
  • Error response with status 400 is given when query parameter validations
    for the page, size, minLat, maxLat, minLng, maxLng, minPrice, or
    maxPrice are violated

Get details for a Spot from an id (Feature 1)

Returns the details of a spot specified by its id.

  • Successful response includes data only for the specified spot
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    and updatedAt
  • Spot data returns aggregate data for numReviews and avgStarRating
  • Spot data returns associated data for images, an array of image urls
  • Spot data returns associated data for Owner, including the id,
    firstName, and lastName
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Create a Review for a Spot based on the Spot's id (Feature 2)

Create and return a new review for a spot specified by id.

  • An authenticated user is required for a successful response
  • New review exists in the database after request
  • Review data returned includes the id, userId, spotId, review,
    stars, createdAt, and updatedAt
  • Error response with status 400 is given when body validations for the
    review or stars are violated
  • Error response with status 404 is given when a spot does not exist with
    the provided id
  • Error response with status 403 is given when a review already exists for
    the spot from the current user

Create a Booking from a Spot based on the Spot's id (Feature 3)

Create and return a new booking from a spot specified by id.

  • An authenticated user is required for a successful response
  • A user is only authorized to create a booking if they do NOT own the spot
  • New booking exists in the database after request
  • Booking data returned includes the id, userId, spotId, startDate,
    endDate, createdAt, and updatedAt
  • Error response with status 404 is given when a spot does not exist with
    the provided id
  • Error response with status 403 is given when a booking already exists for
    the spot on the specified dates

Get all Spots (Feature 1)

Returns all the spots.

  • Seed data exists in the database for spots to be returned.
  • Successful response includes each spot in the database.
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    updatedAt, and previewImage

Get all Bookings for a Spot based on the Spot's id (Feature 3)

Return all the bookings for a spot specified by id.

  • An authenticated user is required for a successful response
  • Seed data exists in the database for bookings to be returned.
  • Successful response includes only bookings for the specified spot
  • If you are NOT the owner of the spot, booking data returned includes the
    spotId, startDate, and endDate for each booking
  • If you ARE the owner of the spot, booking data returned includes the id
    spotId, userId, startDate, endDate, createdAt, and updatedAt for
    each booking
  • If you ARE the owner of the spot, booking data returns associated data for
    User, including the id, firstName, and lastName
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Get all Spots owned by the Current User (Feature 1)

Returns all the spots owned (created) by the current user.

  • An authenticated user is required for a successful response
  • Successful response includes only spots created by the current user
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    updatedAt, and previewImage

Delete a Booking (Feature 3)

Delete an existing booking.

  • An authenticated user is required for a successful response
  • Only the owner of the booking or the owner of the spot is authorized to
    delete the booking
  • Booking record is removed from the database after request
  • Success response includes a message indicating a successful deletion
  • Error response with status 404 is given when a spot does not exist with
    the provided id
  • Error response with status 400 is given when it is past the booking's
    startDate (no deleting of current or past bookings)

Authentication Required

All endpoints that require a current user to be logged in receive a standard
authentication response.

  • Authentication middleware responds with error status 401 when
    authentication is not provided

Get all of the Current User's Bookings (Feature 3)

Return all the bookings that the current user has made.

  • An authenticated user is required for a successful response
  • Successful response includes only bookings created by the current user
  • Booking data returned includes the id, spotId, userId, startDate,
    endDate, createdAt, and updatedAt
  • Booking data returns associated data for Spot, including the id,
    ownerId, address, city, state, country, lat, lng, name,
    price and previewImage

Delete a Spot (Feature 1)

Deletes an existing spot.

  • An authenticated user is required for a successful response
  • Only the owner of the spot is authorized to delete
  • Spot record is removed from the database after request
  • Success response includes a message indicating a successful deletion
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Edit a Booking (Feature 3)

Update and return an existing booking.

  • An authenticated user is required for a successful response
  • Only the owner of the booking is authorized to edit
  • Booking record is updated in the database after request
  • Booking data returned includes the id, userId, spotId, startDate,
    endDate, createdAt, and updatedAt
  • Error response with status 404 is given when a booking does not exist with
    the provided id
  • Error response with status 400 is given when it is past the booking's
    endDate (no editing of past bookings)
  • Error response with status 403 is given when a booking already exists for
    the spot on the specified dates

Authorization Required

All endpoints that require a current user to have the correct role(s) or
permission(s) receive a standard authorization response.

  • Authorization middleware responds with error status 403 when
    an authenticated user does not have the correct role(s) or permission(s)

Add an Image to a Spot based on the Spot's id (Feature 4)

Create and return a new image for a spot specified by id.

  • An authenticated user is required for a successful response
  • Only the owner of the spot is authorized to add an image
  • New image exists in the database after request
  • Image data returned includes the id, imageableId, imageableType, and
    url
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Delete a Review (Feature 2)

Delete an existing review.

  • An authenticated user is required for a successful response
  • Only the owner of the review is authorized to delete
  • Review record is removed from the database after request
  • Success response includes a message indicating a successful deletion
  • Error response with status 404 is given when a spot does not exist with
    the provided id

Get all Reviews of the Current User (Feature 2)

Returns all the reviews written by the current user.

  • An authenticated user is required for a successful response
  • Successful response includes only reviews created by the current user
  • Review data returned includes the id, userId, spotId, review,
    stars, createdAt, and updatedAt
  • Review data returns associated data for User, including the id,
    firstName, and lastName
  • Review data returns associated data for Spot, including the id,
    ownderId, address, city, state, country, lat, lng, name, and
    price
  • Review data returns associated data for images, an array of image urls

Create a Spot (Feature 1)

Creates and returns a new spot.

  • An authenticated user is required for a successful response
  • New spot exists in the database after request
  • Spot data returned includes the id, ownerId, address, city,
    state, country, lat, lng, name, description, price, createdAt,
    and updatedAt
  • Error response with status 400 is given when body validations for the
    address, city, state, country, lat, lng, name, description, or price are violated

Log In a User (Feature 0)

Logs in a current user with valid credentials and returns the current user's
information.

  • Successful response includes the user's id, firstName, lastName,
    email, and token
  • Error response with status 401 is given when invalid credentials are given
  • Error response with status 400 is given when body validations for the
    email, firstName, or lastName are violated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.