/base.lmlab.net

Online shopping system for small(individual) distributors.

Primary LanguageRubyMIT LicenseMIT

base.lmlab.net

Online shopping system for small(individual) distributors.

I have started development v2(private repo). ** The followings are about v1. **

Actors

  • User
    • can sign in/out.
    • can remove their own account.
    • can regist their distributor by ID.
    • can view the profile of their distributor.
    • can change their password and other profiles.
    • can view all products on the database.
    • can add/remove products to the shopping cart.
    • can place/cancel their orders.
      • cancellation is only allowed before the order will be shipped.
    • can view the list of their current/past orders.
  • Distributor
    • can behave as an User.
    • can view all orders from their members.
      • member: Users who belong to the distributor.
      • can change status of the orders.
      • can get the printable page of each order.(a statement of delivery)
    • can show/hide announcements for their members on the dashboard page.
  • Admin
    • has all privileges.
    • can add/edit/remove products.
    • can show/hide announcements on the top page.

Users environment

  • Mainly users and distributors access the site through mobile phones(iPhone, Android).
  • Admin has laptop PC.

Features

  • The system supposes to work as an support tools for other networks(like Amway).
  • Does not support the any payment methods. Just utilises the flow to distribute products.

Views

  • root: Top page. Everyone(includes search engine bots) can see it.
  • (user area)
    • dashboard: Top page for each User. search form, order history, links to other pages.
    • products: A list of products as a result of search.
    • orders(cart): A list of products which an User is going to buy.
      • checkout: Confirmation form.
    • orders(history): A list of products which an User had bought.
    • user: Information about the user.
  • (distributor area)
    • orders(ordered): A list of product which the Distributor has to deliver.
  • (admin area)
    • users: All registered Users and their status.

See also railsapp/config/routes.rb

Status of order

  • in-cart: The product is in the cart. It can be removed.
  • ordered: Just after the user pushed the order button. It's cancellable.
  • shipping: Just after the distributor pushed the accept button.
    • The order can not be canceled on the site.
    • Distributer has the responsibility to deliver the products to Users.
  • arrived: Just after the user received products.
  • canceled: After the order had been canceled.

Database

See railsapp/db/schemas.rb

To set up initial products table. See the content of lib/tasks/import-products.rb. You can import items from Google Spreadsheet.

Gems

  • bootstrap - for responsible layouts.
  • devise - for authenticate users.
  • paper_trail - for versioning.
  • slack-notifier - for Slack notifications.

Steps to create a ruby project from installing Vagrant and VM for butting PUMA servers

install vagrant and virtual box first X to compare >> diff project_dir/vagrant vagrant X vagrant init ubuntu/xenial64 X in vagrant file, comment out the private ip line and vb.memory to 2048 from 1024 X Like this: config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: vb.memory = "2048" end Vagrant up vagrant ssh sudo -i X run these commands one by one X apt -y update apt -y upgrade apt -y install mysql-server apache2 apache2-dev libapache2-mod-passenger rsync git nodejs apt -y install ruby-dev libmysqlclient-dev libmagick++-dev libcurl4-openssl-dev libssl-dev gem install bundler mysql2 rails rmagick therubyracer passenger --no-ri --no-rdoc X skip the lines related to python X X create 2 user lmuser and vagrant user X mysql -e "create user 'lmuser'@'localhost'" mysql -e "grant all privileges on . to 'lmuser'@'localhost'" mysql -e "create user 'vagrant'@'localhost'" mysql -e "grant all privileges on . to 'lmuser'@'localhost'" exit rails new project_name —database=mysql cd /vagrant/ mv project_name railsapp cd railsapp/ ls edit username and password of database.yml file rails db:create

Installation

If you want to use notifications for Slack. Obtain incoming webhook URL of your workspace(channel), and set it as an environment variable like below.

SetEnv BASE_SLACK_WEBHOOK_URL https://hooks.slack.com/services/(yourtokens)