CodeJellee / API-project

0 stars 0 forks source link

AirBnBeyond

AirBnBeyond is an online marketplace that connects travelers with unique accommodations and experiences. Inspired by AirBnB, whether you're seeking a cozy cottage or an adventurous city stay, AirBnBeyond offers a diverse range of options to make your travels memorable.

Check out AirBnBeyond

Technologies Used

Spots

Screenshot 2023-08-30 at 6 57 38 PM

One spot page and reviews

Screenshot 2023-08-30 at 6 57 55 PM

Getting started

  1. Clone this repository:

    https://github.com/CodeJellee/API-project.git

  2. Install denpendencies into the Backed and the Frontend by making a terminal for each one and then run the following:

    • npm install
  3. Create a .env file using the .envexample provided

  4. Set up your database with information from your .env and then run the following to create your database, migrate, and seed:

    • npx dotenv sequelize db:create
    • npx dotenv sequelize db:migrate
    • npx dotenv sequelize db:seed:all
  5. Start the app for both backend and frontend using:

    • npm start
  6. Now you can use the Demo User or Create an account


Features

Spots

Reviews

Future Features

Bookings

Logged-in Users can

AWS

Logged-in Users can

Google Maps Api

Logged in Users can

Database Schema Design

airbnb-database-schema

Endpoints

Request Purpose Return Value
GET/api/auth/ This fetch is sent upon initial app load an on subsequent refreshes. It returns an object representing the current user, if user is logged in. 283
GET/api/login/ This fetch attempts to login a user with the provided credientials. It returns an object representing the current user, if validation succeeds. 283

API Documentation

USER AUTHENTICATION/AUTHORIZATION

All endpoints that require authentication

All endpoints that require a current user to be logged in.

All endpoints that require proper authorization

All endpoints that require authentication and the current user does not have the correct role(s) or permission(s).

Get the Current User

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

Log In a User

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

Sign Up a User

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

SPOTS

Get all Spots

Returns all the spots.

Get all Spots owned by the Current User

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

Get details of a Spot from an id

Returns the details of a spot specified by its id.

Create a Spot

Creates and returns a new spot.

Add an Image to a Spot based on the Spot's id

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

Edit a Spot

Updates and returns an existing spot.

Delete a Spot

Deletes an existing spot.

REVIEWS

Get all Reviews of the Current User

Returns all the reviews written by the current user.

Get all Reviews by a Spot's id

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

Create a Review for a Spot based on the Spot's id

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

Add an Image to a Review based on the Review's id

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

Edit a Review

Update and return an existing review.

Delete a Review

Delete an existing review.

BOOKINGS

Get all of the Current User's Bookings

Return all the bookings that the current user has made.

Get all Bookings for a Spot based on the Spot's id

Return all the bookings for a spot specified by id.

Create a Booking from a Spot based on the Spot's id

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

Edit a Booking

Update and return an existing booking.

Delete a Booking

Delete an existing booking.

IMAGES

Delete a Spot Image

Delete an existing image for a Spot.

Delete a Review Image

Delete an existing image for a Review.

Add Query Filters to Get All Spots

Return spots filtered by query parameters.