Giter VIP home page Giter VIP logo

shopping-cart-app's Introduction

shopping-cart-app

  • ショッピングカート機能のアプリ

7db5f30da7a721b76edb59fc4611c1a3

demo

Build Setup

# install dependencies
$ yarn install

# serve with hot reload at localhost:3000
$ yarn run dev

# build for production and launch server
$ yarn run build
$ yarn start

# generate static project
$ yarn run generate

For detailed explanation on how things work, checkout Nuxt.js docs.

shopping-cart-app's People

Contributors

samuraikun avatar

Watchers

James Cloos avatar  avatar

shopping-cart-app's Issues

アイテム一覧画面(カート画面)

URL

  • ルートURL(/items)を選択したアイテムの一覧画面(カート画面)にする

データ設計

  • Firestoreを使用
  • FirestoreのCollection、Documentによるデータ管理
    • 階層データ構造
    • Collectionは、RDBでいうテーブルに似ている
    • Doocumentは、RDBでいうレコードに似ている

Collections

  • Items Collection
  • ShoppingCart Collection

Items Collection

  • 全てのアイテムが格納される
{
  name: String,
  thumbnail: String,
  price: Integer
}

ShoppingCart Collection

  • 選択したアイテムが格納される
{
  items: Items Collection
}

実装方針

  • Firestoreにあるアイテム情報一覧をVueコンポーネントのmountedのタイミングで取得
  • firestoreのSDKを使用
  • 元データ自体は、モックとして用意。Firebaseコンソール画面から直接作るもよし、別の方法でも

見積もり

1pt = 1日換算

  • 元データの用意
  • データの取得

見積もり結果:0.5pt

データ設計

登場するモデル

  • Customer
    • ユーザー
    • アイテムを見れる
    • カートにアイテムを追加できる
  • Product
    • アイテム自体の情報を持つ
    • Eコーマスで言う商品に当たる
    • ユーザーによってカートに追加される
  • Cart
    • アイテムを一箇所にまとめる
    • ユーザーによってアイテムを追加される

Customer

{
  id: String,
  name: String,
  isActive: Boolean, // 論理削除フラグ
  cartRef: Reference // ex. /carts/{cartID}
  createdAt: Timestamp,
  updatedAt: Timestamp
}

Product

{
  id: String
  name: String,
  description: String,
  price: Integer,
  stock: Integer, // 在庫数
  shopRef: Reference, // 商品を管理するお店モデル。今回は特に使用していない
  isActive: Boolean,
  createdAt: Timestamp,
  updatedAt: Timestamp
}

Cart

  • ショッピングカートのモデル
  • Customerと1対1の関係
{
  name: String,
  customerRef: Reference,
  isActive: Boolean,
  createdAt: Timestamp,
  updatedAt: Timestamp,
  products: SubCollection
}

Cart/Products

  • カート内に追加されたアイテムたち
    • Cart : Products = 1 : Nのリレーションを持たせるため、Cartドキュメント内にProductのサブコレクションをもたせる
  • Cart/Product : Product = 1 : 1
{
  cart/products: {
    cartRef: reference,
    productRef: reference,
    ...products // Productドキュメントの各データ 
  }
}

機能概要

概要

  • 簡単なShopping Cartアプリ

開発要件

[must] アイテム選択画面

  • ユーザーが複数のアイテムを選択できること
  • ユーザーが選択したアイテムをデータベースに保存できること

[must] アイテム一覧画面

  • データベースからデータを取得し、前のページで選択したアイテム一覧を確認することができること

認証

  • Googleアカウント認証
  • 認証完了時をトリガーにCloud Functions で、Firestoreにユーザーデータを新規作成

アイテム選択画面

概要

  • ユーザーが複数のアイテムを選択できること
  • ユーザーが選択したアイテムをデータベースに保存できること

ユーザーが複数のアイテムを選択できること

URL

  • /

画面イメージ

アイテム選択画面

  • アイテム一覧(Items Collection)が表示されている
  • 各アイテムは、カードUIにして、「カートに追加」というボタンでカートにアイテムを追加する
  • アイテム一覧画面のヘッダー部分にカートアイコンのボタンを用意

DB操作

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.