/Guitar-Inventory-App-Nodejs

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Guitar-Inventory-App-Nodejs

A project developed as a part of job interview assignment.

Problem Statement:

The owner of a guitar store wants to keep an inventory of all the guitars he owns. He noticed the customers ask for guitars based on their brand names or model names, the type of the guitar i.e electric or acoustic, the number of strings, and the price. Each guitar has a unique serial number which he uses to track the guitar. He also needs to keep a track of when he bought the instrument and when he sold it.

Along with the guitars he also sells accessories for them. He sells two kinds of guitar picks - a wooden one for acoustic guitars, and a plastic one for electric guitars. He also sells straps for all the guitars. There are three types of straps, regular, large and extra large.

Question:

  1. Create a database schema for the guitar shop owner to be able to store his inventory.
  2. Write a function which will return a list of guitars sold by the owner in a given month
  3. Create an API that will show the available inventory of the guitar owner

Solution:

There was no language constraint so I used nodejs for fast development.

  1. I first designed the database, time taken ~10 mins.
  2. Then I wrote db function to return list of guitars sold by the owner in month passed in params, time taken ~30 mins.
  3. Took boilerplate CRUD code for nodejs, modified it to my requirement, testing, bugfix, etc, time taken ~1 hr. Project is developed in Restful way. So same endpoint will cater everything depending on protocol used.

Steps:

  1. Git clone the repo or download zip.
  2. cd Guitar-Inventory-App-Nodejs
  3. npm install
  4. node server
  5. Open http://localhost:8001/api/v1 in your browser.

P.S. Comparatively easier problem than expected.