Giter Club home page Giter Club logo

aeki's Introduction

AEKI - Japanese Furniture Store

Rails app for a basic store with products, shopping cart, orders and users.

Gems:

  1. Devise
  2. CanCanCan
  3. Carrierwave + Cloudinary

Steps

These are the steps I followed when working on this app:

  1. Define data-model
  2. Define screen flow

Database Structure

  1. Product_type
  • name:string

  • description:text

  • image:string

  • has_many :products

  1. Product
  • name:string

  • description:text

  • image:string

  • price:float

  • belongs_to :product_type

  • belongs_to :inventory

  • has_many :line_items

  1. Inventory
  • quantity:integer

  • has_many :products

  1. Cart
  • has_many :line_items
  1. Line_item
  • price (empty till checkout?)

  • quantity

  • belongs_to :cart

  • belongs_to :product

  • belongs_to :order

  1. Order
  • belongs_to :user

  • has_many :line_items

  • model method: availability_check()

  1. User
  • standard devise fields (email, password)

  • has_one :profile

  • has_many :orders

  1. Profile
  • name:string

  • address:string

  • image:string

  • authorization_level

  • belongs_to :user

-- Session:

  • session[cart_id, user_id]

-- availability_check

  • product with quantity 0 cannot be added to cart (button "AddToCart" disabled). Method in product model.
  • Every time quantity in cart is changed, availability should be checked
  • When you add the same product to the cart, availability should be checked

-- cart line items

  • When the same product is added to cart, only the quantity should change

-- update Inventory

  • git

-- cart management

  • at checkout, line items are copied from cart to order
  • at place order, cart is destroyed

Cart management

  1. Product page:
  • AddToCart button on product calls method Order.add_to_cart(session, product)

    • add_to_cart method checks if a cart exist in the session.
    • If yes, it checks if the cart contains the product.
    • if no, it creates a new line item hash with product and quantity 1

    -> Entry point from wherever if cart is not empty (via some "go to cart" button)

    • Pre-populates a new order form (Orders#new) with session[cart] details
  1. Order new page:
  • Page has a 3 buttons: "Back to products" - "Update" - "Place order"
    • Back to products
      • just a link that re-directs you to the Products#index
    • Update
      • For now, just replaces the session[:cart] with whatever is in the form
      • And stays on the page with just a message "Cart updated"
    • Place order
      • Form data is posted to Orders table creating an order (Orders#create)
      • Takes you to Orders#show page for the newly created order

Screen flow

  1. Homepage
  • Menu with user/login
  • Welcome header (image/jumbotron?)
  • Thumbnail for each product_type (clickable)
  1. Catalog page - one page for each product type
  • Header with product type name, description and image
  • Body with thumbnails for each product belonging to the type (clickable)
  1. Product page - one page for each product
  • Product name, description, image
  • Button "Add to cart"
  1. Shopping cart bar -- If not empty displayed on every page --
  • List of line items with product, quantity, price, total_price_line and total_price_cart
  • Button "Checkout"
  1. Order
  • Copy of cart with line_items
  • Button "Place order" to complete flow

aeki's People

Contributors

sdurighello avatar thomasbrockmeier avatar ecthelion3 avatar

Watchers

 avatar Mark Nuiver avatar  avatar

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.