Edgy, an Etsy replica, is an anime themed platform where users can search, buy, sell and engage in the popularity of products through reviews and likes.
1. New account creation, log in, log out, and guest/demo log in with user authentication/authorization
- Users can sign up, log in, and log out.
- Users can use a demo login to try the site.
- Users can't use certain features without logging in (ex: create product to sell, leave/edit a review, like a product, add to cart).
- Logged in users and logged out users are directed to a landing page recommending various category discoveries to find products, trending gifts, personalized gifts, editor picks, and more!
- Users can create, update, and delete products.
- Products will contain both text and images.
- Each product displays its product name, cost, star reviews if there are any available and if it has been favorited by the user.
- Users can navigate to a detailed view of a product which includes the written reviews and description of the product.
- Users can view a list all their listings.
- The main feed displays products from all users.
- Users can review any product as long as it is not their own.
- Users can update or delete their own reviews.
- Users can view a list all the reviews they have created.
- Each review displays a star rating between 1 to 5 stars, the review content, name of reviewer and posted date (MM/DD/YYYY).
- Reviews are displayed beneath the products they are associated with.
- Users can like and unlike products.
- Each products displays a heart icon that will notify users if they have liked a product or not.
- Users can view a list of products they have liked.
- Users can view a shopping cart with items they would like to purchase.
- Users can add and remove items from their cart.
- Users search for certain types of products in the search bar.
- Users can sort through their postings via a filter function
All endpoints that require a current user to be logged in.
- Request: endpoints that require authentication
- Error Response: Require authentication
-
Status Code: 401
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Authentication required" }
-
All endpoints that require authentication and the current user does not have the correct role(s) or permission(s).
- Request: endpoints that require proper authorization
- Error Response: Require proper authorization
-
Status Code: 403
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Forbidden" }
-
Returns the information about the current user that is logged in.
-
Require Authentication: true
-
Request
- Method: GET
- URL: /api/session
- Body: none
-
Successful Response when there is a logged in user
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "user": { "id": 1, "firstName": "demo1", "lastName": "work1", "email": "[email protected]", "username": "Demo" } }
-
-
Successful Response when there is no logged in user
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "user": null }
-
Logs in a current user with valid credentials and returns the current user's information.
-
Require Authentication: false
-
Request
- Method: POST
- URL: /api/session
-
Headers:
- Content-Type: application/json
-
Body:
{ "credential": "[email protected]", "password": "secret password" }
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "user": { "id": 1, "firstName": "demo1", "lastName": "work1", "email": "[email protected]", "username": "Demo" } }
-
-
Error Response: Invalid credentials
-
Status Code: 401
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Invalid credentials" }
-
-
Error response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "credential": "Email or username is required", "password": "Password is required" } }
-
Creates a new user, logs them in as the current user, and returns the current user's information.
-
Require Authentication: false
-
Request
- Method: POST
- URL: /api/users
-
Headers:
- Content-Type: application/json
-
Body:
{ "firstName": "demo2", "lastName": "work2", "email": "[email protected]", "username": "marnie", "password": "secret password" }
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "user": { "id": 1, "firstName": "demo2", "lastName": "work2", "email": "[email protected]", "username": "marnie" } }
-
-
Error response: User already exists with the specified email
-
Status Code: 500
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "User already exists", "errors": { "email": "User with that email already exists" } }
-
-
Error response: User already exists with the specified username
-
Status Code: 500
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "User already exists", "errors": { "username": "User with that username already exists" } }
-
-
Error response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "email": "Invalid email", "username": "Username is required", "firstName": "First Name is required", "lastName": "Last Name is required" } }
-
Returns all the products.
-
Require Authentication: false
-
Request
- Method: GET
- URL: /api/products
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "Products": [ { "id": 1, "itemName": "Spiked Collar", "price": 15.99, "description": "Black pleather spiked collar will attract the attention you seek!", "previewImage": "image url", "category": "jewelry" } ] }
-
Returns all the products owned (created) by the current user.
-
Require Authentication: true
-
Request
- Method: GET
- URL: /api/products/current
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "Products": [ { "id": 1, "ownerId": 1, "itemName": "Spiked Collar", "price": 15.99, "description": "Black pleather spiked collar will attract the attention you seek!", "previewImage": "image url", "category": "jewelry", } ] }
-
Returns the details of a product specified by its id.
-
Require Authentication: false
-
Request
- Method: GET
- URL: /api/products/:productId
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "itemName": "Spiked Collar", "price": "15.99", "description": "Black pleather spiked collar will attract the attention you seek!", "previewImage": "image url", "category": "jewelry", "quantity": 3, "sellerId": 3, "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , "Reviews": [ { "id": 1, "userId": 1, "star": 4, "review": "looks so cute", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }, { "id": 2, "userId": 1, "star": 5, "review": "matches my outfit perfectly", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , } ], "Seller": { "id": 1, "firstName": "John", "lastName": "Smith", "email": "[email protected]", "username": "john", } }
-
-
Error response: Couldn't find a Product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Product couldn't be found" }
-
Creates and returns a new Product.
-
Require Authentication: true
-
Request
- Method: POST
- URL: /api/products
-
Headers:
- Content-Type: application/json
-
Body:
{ "item_name": "Spiked Collar", "price": 15.99, "description": "Black pleather spiked collar will attract the attention you seek!", "quantity": 3, "previewImage": "image url", "category": "jewelry", }
-
Successful Response
-
Status Code: 201
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "sellerId": 1, "item_name": "Spiked Collar", "price": "15.99", "description": "Black pleather spiked collar will attract the attention you seek!", "quantity": 3, "previewImage": "image url", "category": "jewelry", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }
-
-
Error Response: Body validation error
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "item_name": "Item name is required", "price": "Price is required", "description": "Description is required", "quantity": "Quantity is required", "previewImage": "Preview image is required", "category": "Category is required", } }
-
Deletes an existing product.
-
Require Authentication: true
-
Require proper authorization: Product must belong to the current user
-
Request
- Method: DELETE
- URL: /api/products/:productId
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Successfully deleted" }
-
-
Error response: Couldn't find a Product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Product couldn't be found" }
-
Returns all the reviews written by the current user.
-
Require Authentication: true
-
Request
- Method: GET
- URL: /api/reviews/your_reviews
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "User":{"id": 1, "firstName": "John", "lastName": "Smith" } "Reviews": [ { "id": 1, "userId": 1, "stars": 5, "review": "This was an awesome product!", "Product": { "id": 1, "sellerId": 1, "item_name": "Spiked Collar", "price": "15.99", "description": "Black pleather spiked collar will attract the attention you seek!", "previewImageURL": "https://m.media-amazon.com/images/S/mms-media-storage-prod/final/BrandPosts/brandPosts/a868ad77-879d-40d7-8bed-dad04be63a15/f43af8aa-0309-40d6-a244-87b52d0ef5df/media._SL480_.jpeg", "quantity": 3, "category": "jewelry", }, } ] }
-
Returns all the reviews that belong to a product specified by product id.
-
Require Authentication: false
-
Request
- Method: GET
- URL: /api/products/:productId
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "itemName": "Spiked Collar", "price": "15.99", "description": "Black pleather spiked collar will attract the attention you seek!", "previewImage": "image url", "category": "jewelry", "quantity": 3, "sellerId": 3, "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , "Reviews": [ { "id": 1, "userId": 1, "star": 4, "review": "looks so cute", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }, { "id": 2, "userId": 1, "star": 5, "review": "matches my outfit perfectly", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , } ], "Seller": { "id": 1, "firstName": "John", "lastName": "Smith", "email": "[email protected]", "username": "john", } }
-
-
Error response: Couldn't find a product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Item couldn't be found" }
-
Create and return a new review for a product specified by id.
-
Require Authentication: true
-
Request
- Method: POST
- URL: /api/products/:productId/reviews
-
Headers:
- Content-Type: application/json
-
Body:
{ "review": "This was an awesome product!", "stars": 5, }
-
Successful Response
-
Status Code: 201
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "userId": 1, "stars": 5, "review": "This was an awesome product!", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }
-
-
Error Response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "review": "Review text is required", "stars": "Stars must be rated from 1 to 5", } }
-
-
Error response: Couldn't find a Product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Product couldn't be found" }
-
-
Error response: Review from the current user already exists for the Product
-
Status Code: 500
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "User already has a review for this Product" }
-
Update and return an existing review.
-
Require Authentication: true
-
Require proper authorization: Review must belong to the current user
-
Request
- Method: PUT
- URL: /api/products/:productId
-
Headers:
- Content-Type: application/json
-
Body:
{ "review": "This was an awesome product!", "stars": 5, }
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "userId": 1, "stars": 5, "review": "This was an awesome product!", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }
-
-
Error Response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "review": "Review text is required", "stars": "Stars must be rated from 1 to 5", } }
-
-
Error response: Couldn't find a product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Product couldn't be found" }
-
Update and return an existing review.
-
Require Authentication: true
-
Require proper authorization: Review must belong to the current user
-
Request
- Method: PUT
- URL: /api/reviews/your_reviews
-
Headers:
- Content-Type: application/json
-
Body:
{ "review": "This was an awesome product!", "stars": 5, }
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "id": 1, "userId": 1, "stars": 5, "review": "This was an awesome product!", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }
-
-
Error Response: Body validation errors
-
Status Code: 400
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Bad Request", "errors": { "review": "Review text is required", "stars": "Stars must be rated from 1 to 5", } }
-
Delete an existing review.
-
Require Authentication: true
-
Require proper authorization: Review must belong to the current user
-
Request
- Method: DELETE
- URL: /api/products/:productId
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Successfully deleted" }
-
-
Error response: Couldn't find a Product with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Product couldn't be found" }
-
Delete an existing review.
-
Require Authentication: true
-
Require proper authorization: Review must belong to the current user
-
Request
- Method: DELETE
- URL: /api/reviews/your_reviews
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Successfully deleted" }
-
Return all the shopping cart that the current user has made.
-
Require Authentication: true
-
Request
- Method: GET
- URL: /api/carts/shopping_cart
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "Shopping Cart": [ { "id": 1, "userId": 2, "productId": 1, "Products": { "id": 1, "sellerId": 1, "itemName": "Spiked Collar", "price": 15.99, "description": "Black pleather spiked collar will attract the attention you seek!", "quantity": 3, "previewImage": "image url", "category": "jewelry", "createdAt": "2021-11-19 20:39:36", "updatedAt": "2021-11-19 20:39:36" , }, } ] }
-
Adds an item to the cart for the current user
-
Require Authentication: True
-
Request
- Method: POST
- URL: /api/products/:productId/add_to_cart
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You've successfully added this item to cart." }
-
-
Error response: Item already added to the cart
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You already added the item to the cart." }
-
-
Error response: Current user Id matches product sellerId
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You cannot add your own product to the cart." }
-
Delete an existing cartId.
-
Require Authentication: true
-
Require proper authorization: Shopping Cart must belong to the current user or the cart item must belong to the current user
-
Request
- Method: DELETE
- URL: /api/carts/shopping_cart/:productId
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Successfully deleted" }
-
-
Error response: Couldn't find an item with the specified id
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "Item couldn't be found" }
-
Returns all the Favorite Items that belong to the Current User
-
Require Authentication: True
-
Request
- Method: GET
- URL: /api/favorites/current
- Body: none
-
Successful Response
-
Status Code: 200
-
Headers:
- Content-Type: application/json
-
Body:
{ "user": { "id": 2, "first_name": "John", "last_name": "Smith", "userFavorites": { "Seller": { "id": 1, "first_name": "Demo", "last_name": "User", "username": "demo", }, "Product": { "id": 1, "productId": 1, "itemName": "Spiked Collar", "price": 15.99, "description": "Black pleather spiked collar will attract the attention you seek!", "previewImage": "image url", "category": "jewelry", "sellerId": 1, } } } }
-
Favorites an item for the current user
-
Require Authentication: True
-
Request
- Method: POST
- URL: /api/products/:productId
- Body: none
-
Error response: Item already added to favorites
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You already favorite this item." }
-
-
Error response: Current user Id matches product sellerId
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You cannot favorite your own product." }
-
-
Error response: Not logged in
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You need to be logged in." }
-
Favorites an item for the current user
-
Require Authentication: True
-
Request
- Method: POST
- URL: /api/
- Body: none
-
Error response: Item already added to favorites
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You already favorite this item." }
-
-
Error response: Current user Id matches product sellerId
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You cannot favorite your own product." }
-
-
Error response: Not logged in
-
Status Code: 404
-
Headers:
- Content-Type: application/json
-
Body:
{ "message": "You need to be logged in." }
-
Delete a Favorite by Current User
- Require Authentication: True
- Request
- Method: DELETE
- URL: /api/favorites/:productId
- Body: none
Delete a Favorite by Current User
- Require Authentication: True
- Request
- Method: DELETE
- URL: /api/favorites/current
- Body: none