Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
charlieKsw committed Oct 24, 2024
2 parents 8d2e885 + b45fbd0 commit f5da4da
Showing 2 changed files with 199 additions and 10 deletions.
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Shopping Cart

Build a mini e-commerce shopping portal featuring product listing and a functional shopping cart.\
Build a mini food ordering web app featuring product listing and a functional shopping cart.\
Prioritize correctness in functionality while getting it to look as close to the design as possible.

For this task you will need to integrate to our demo e-commerce API for listing products and submitting orders.
For this task you will need to integrate to our demo e-commerce API for listing products and placing orders.

**API Reference**

@@ -12,24 +12,30 @@ You can find our [API Documentation](https://orderfoodonline.deno.dev/public/ope
API documentation is based on [OpenAPI3.1](https://swagger.io/specification/v3/) specification.
You can also find spec file [here](https://orderfoodonline.deno.dev/public/openapi.yaml).

**Functional Requirements**

**Minimum requirements**

- Display products with image
- Add items to the cart and remove item
- Display products with images
- Add items to the cart and remove items
- Show order total correctly
- Increase or decrease item count in the cart
- Show order confirkmation after placing the order
- Show order confirmation after placing the order
- Interactive hover and focus states for elements
- Integrates with demo REST API for product listing and placing orders

**Bonus Goals**

- Allow users to enter a discount code (above confirm order button)
- Allow users to enter a discount code (above the "Confirm Order" button)
- Discount code `HAPPYHOURS` applies 18% discount to the order total
- Discount code `BUYGETONE` gives the lowest priced item for free
- Responsive design based on device's screen size

**Are You a Full Stack Developer??**

Impress us by implementing your own version of the API based on the OpenAPI specification.\
Choose any language or framework of your choice. For example our top pick for backend is [Go](https://go.dev)

> The API immplementation example available to you at orderfoodonline.deno.dev/api is simplified and doesn't handle some edge cases intentionally.
> Use your best judgement to build a Robust API server.
## Design

You can find a [Figma](https://figma.com) design file `design.fig` that you can use.
@@ -69,4 +75,12 @@ Here is an example workflow (you can use it as a reference or use your own workf

> 💡 Replace or Modify this README to explain your solution and how to run and test it.
🚀
_By following these guidelines, you should be able to build a functional and visually appealing mini e-commerce shopping portal that meets the minimum requirements and bonus goals. Good luck! 🚀_

**Resources**

- API documentation: https://orderfoodonline.deno.dev/public/openapi.html
- API specification: https://orderfoodonline.deno.dev/public/openapi.yaml
- Figma design file: [design.fig](./design.fig)
- Red Hat Text font: https://fonts.google.com/specimen/Red+Hat+Text

175 changes: 175 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
openapi: 3.1.0
info:
title: Order Food Online - OpenAPI 3.1
description: |-
This is a e-commerce API based on the OpenAPI 3.1 specification. You can find out more about
Use API key `apitest`
Some useful links:
- [Repository](https://github.com/oolio-group/front-end-cart)
version: 1.0.0
externalDocs:
description: Find out more about the challenge
url: http://swagger.io
servers:
- url: https://orderfoodonline.deno.dev/api
tags:
- name: product
description: Everything about products
- name: order
description: Place Orderso
paths:
/product:
get:
tags:
- product
summary: List products
description: Get all products available for order
operationId: listProducts
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
/product/{productId}:
get:
tags:
- product
summary: Find product by ID
description: Returns a single product
operationId: getProduct
parameters:
- name: productId
in: path
description: ID of product to return
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
'400':
description: Invalid ID supplied
'404':
description: Product not found
/order:
post:
tags:
- order
summary: Place an order
description: Place a new order in the store
operationId: placeOrder
security:
- api_key: ["create_order"]
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderReq'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid input
'401':
description: Unauthorized
'403':
description: Forbidden
'422':
description: Validation exception
components:
schemas:
Order:
type: object
properties:
id:
type: string
examples: ["0000-0000-0000-0000"]
items:
type: array
items:
type: object
properties:
productId:
type: string
description: ID of the product
quantity:
type: integer
description: Item count
products:
type: array
items:
$ref: '#/components/schemas/Product'
OrderReq:
type: object
description: Place a new order
properties:
couponCode:
type: string
description: Optional promo code applied to the order
items:
type: array
items:
type: object
properties:
productId:
type: string
description: ID of the product (required)
quantity:
type: integer
description: Item count (required)
required:
- productId
- quantity
required:
- items
Product:
type: object
properties:
id:
type: string
examples: ["10"]
name:
type: string
examples: ["Chicken Waffle"]
price:
type: number
format: float
description: Selling price
category:
type: string
examples: [Waffle]
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
xml:
name: '##default'
securitySchemes:
api_key:
type: apiKey
name: api_key
in: header


0 comments on commit f5da4da

Please sign in to comment.