The following cards will guide the implementation of the AirBnB API. Each
section should be copied into it's own card on the Kanban project board.
Each feature's progress should be tracked by checking off requirements as they
are met and progressing the cards from the Backlog
, Next Tasks
,
In Progress
, In Review
, and Accepted
columns.
Copy each of the following sections into its own card on a Kanban board for the project. GitHub Kanban boards use markdown formatting, allowing these sections to be copied directly:
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
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)
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
, andtoken
- 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
, orlastName
are violated
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
, andtoken
- 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
, orlastName
are violated
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
, andtoken
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
,previewImage
, andavgRating
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
, andupdatedAt
- Error response with status 400 is given when body validations for the
address
,city
,state
,country
,lat
,lng
,name
,description
, orprice
are violated
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
,url
, andpreview
- Error response with status 404 is given when a spot does not exist with
the provided
id
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
,previewImage
, andavgRating
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
, andupdatedAt
- Spot data returns aggregate data for
numReviews
andavgStarRating
- Spot data returns associated data for
SpotImages
, an array of image data including theid
,url
, andpreview
- Spot data returns associated data for
Owner
, including theid
,firstName
, andlastName
- Error response with status 404 is given when a spot does not exist with
the provided
id
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
, andupdatedAt
- Error response with status 400 is given when body validations for the
address
,city
,state
,country
,lat
,lng
,name
,description
, orprice
are violated - Error response with status 404 is given when a spot does not exist with
the provided
id
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
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
, andupdatedAt
- Error response with status 400 is given when body validations for the
review
orstars
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 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
andurl
- 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
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
, andupdatedAt
- Review data returns associated data for
User
, including theid
,firstName
, andlastName
- Review data returns associated data for
Spot
, including theid
,ownerId
,address
,city
,state
,country
,lat
,lng
,name
,price
, andpreviewImage
- Review data returns associated data for
ReviewImages
, an array of image data including theid
andurl
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
, andupdatedAt
- Review data returns associated data for
User
, including theid
,firstName
, andlastName
- Review data returns associated data for
ReviewImages
, an array of image data including theid
andurl
- Error response with status 404 is given when a spot does not exist with
the provided
id
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
, andupdatedAt
- Error response with status 400 is given when body validations for the
review
, orstars
are violated - Error response with status 404 is given when a review does not exist with
the provided
id
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
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
, andupdatedAt
- 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
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
, andupdatedAt
- Booking data returns associated data for
Spot
, including theid
,ownerId
,address
,city
,state
,country
,lat
,lng
,name
,price
andpreviewImage
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
, andendDate
for each booking - If you ARE the owner of the spot, booking data returned includes the
id
spotId
,userId
,startDate
,endDate
,createdAt
, andupdatedAt
for each booking - If you ARE the owner of the spot, booking data returns associated data for
User
, including theid
,firstName
, andlastName
- Error response with status 404 is given when a spot does not exist with
the provided
id
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
, andupdatedAt
- 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
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)
Delete an existing image for a Spot.
- An authenticated user is required for a successful response
- Only the owner of the spot 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 a spot image does not exist
with the provided
id
Delete an existing image for a Review.
- An authenticated user is required for a successful response
- Only the owner of the review 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 a review image does not exist
with the provided
id
Return spots filtered by query parameters.
- Query parameters are accepted for
page
,size
,minLat
,maxLat
,minLng
,maxLng
,minPrice
, andmaxPrice
- Default values are provided for the
page
andsize
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
, andpreviewImage
for each spot - Successful response includes the
page
andsize
of the returned payload - Error response with status 400 is given when query parameter validations
for the
page
,size
,minLat
,maxLat
,minLng
,maxLng
,minPrice
, ormaxPrice
are violated