Code Monkey home page Code Monkey logo

product-catalog's Introduction

PRODUCT CATALOG APP

A simple product catalog app that returns a couple of mobile phones like iPhone 7, Samsung Galaxy S7 etc. with some simple attributes like product image, title, price, description and color

Technologies Used and Requirements

  • Ruby (version 2.7.4)
  • Bundler
  • Rails API for backend web service
  • Rubocop for linting
  • Prettier for formating
  • heroku for API deployment
  • Rspec for testing

FRONTEND REPO LINK

Development (Running locally)

  • Clone the project
git clone https://github.com/bimbolabuari/product-catalog.git
  • Install Dependencies
bundle install
  • Run Migration with
bundle exec rails db:migrate
  • Setup your database with:
bundle exec rails db:setup
# this command will create the database, load the schema, and initialize it with the seed data.
  • Start the server using:
rails server

API deployed demo host url

Model Validation

Only one model phone is used in this app to display the phones.

Data scheme

The phone model has eight (5) attributes (columns) with the following scheme:

  • title represents the phone_name stored as string on the db. This was done with the assumption that title is not numeric and easy to guess.

  • price is stored as integer on the db, The Integer is more accurate with arithmetic calculations hence the preference over other similar data types.

  • description, color and image are stored as string.

  • created_at and updated_at are auto generated datetime

See more details in the table below:

Name Type Example
title string "iPhone 12"
description string "This is the lastest model"
price integer 1200
color string "Gold"
image string "https://upload.wikimedia.org/wikipedia/commons/b/b2/A_photo_of_the_LG_V60_ThinQ_5G.jpg"

QA

To run the automated test, run

rspec --force-color --format documentation

To run Rubocop by itself, you may run the lint task:

rubocop

Or to automatically fix issues found (where possible):

rubocop -a

You can also check against Prettier:

npx prettier  --check "**/*.{html,md,json,yaml,yml}"

and to have it fix (to the best of its ability) any format issues, run:

npx prettier  --write "**/*.{html,md,json,yaml,yml}"

๐Ÿ‘ค Author

Acknowledgement

๐Ÿ“ License

MIT licensed.

product-catalog's People

Contributors

bimbolabuari avatar

Watchers

 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.