Giter VIP home page Giter VIP logo

simpleinventory's Introduction

SimpleInventory

ASP.Net simple inventory system with REST API

To Run this App:

  1. Download to local repository

  2. Open with Visual Studio (Used VS 2015 to create it)

  3. Run with Chrome (or other) browser to see simple web test page, or

  4. Run unit tests.

Documentation and Assumptions

This simple demo application was created using Visual Studio 2015 using

API

GET api/inventory - returns all items in the inventory

GET api/inventory/{label} - get a specific inventory item by label if it exists

POST api/inventory/{item} - add an item to the inventory by {item}. Item should contain these field : (string)label, (DateTime)expiration, (string)type.

DELETE api/inventory/{label} - remove an item from inventory if it exists.

Design

The design was implemented through Visual Studio, selecting a ASP Web API project type, and then and empty project. I choose empty project so as to eliminate all the extra files generated by the system, and just show my work. I then created directories for "Models", "Controllers", and "Service" so as to keep the core files neatly organized. This project roughly follows the MVC pattern, minus the views since it is purely an API provider. The service directory holds the code for the automatic data expiration system, that unlike the api code, is initiated at startup and runs continously. The Models directory holds data related files. The controller directory holds the one controller file that supports the inventory api methods.

The inventory data is held in a local repository which is implemented as a singleton class so that all users plus the expiration task can have access to the exact same data set. All methods for getting, adding, or removing data are protected by a thread locking mechanism to prevent data corruption due to simultaneous access.

The automatic data expiring service runs in its own thread, and wakes up once a second to check for expired data.

The unit tests were implemented in their own directory, separate from the main project code, as is standard practice for code and test separation/organization. There is a separate unit test file for each of the API methods. The unit test cover just the basic, positive test cases at this time. This was a trade-off for time to complete this demo project.

Assumptions for this Simple Inventory ASP.Net application

  1. Inventory items are only specified by their "label" attribute.

  2. There is no implementation of inventory count for a particular item. Adding a new item with the same label as an existing item will over-write the exisiting item. Removing a particular item removes the one and only item with this label.

  3. The system does not implement Authorization or Authentication at this time. Anyone can access, add, or remove any item.

  4. The mechanism for automatically removing expired items runs as a separate, stand-alone thread. This thread wakes-up every second to check the inventory for expired items. If an item has expired, it is removed from the data store, and a debug console message is displayed for notification. This 'expiring' mechanism does not take into account how many items are in the inventory so it could potentialy take a significant amount of time and resources to run if the data store contained a large amount of items. Ideally this mechanism would have built-in throttling so that it would not tie-up computer resources and the data repository.

  5. The REST API for the inventory system uses the basic HTTP verbs to provide CRUD data access (minus the 'U' at this time.).

  6. This demo app only supports routes for the Inventory system based on 'Label' parameter input at this time. This was done by modifying the default route template. For extensibility, this would need to be changed later so the default used 'id' as the parameter which is commonly used in REST apis.

simpleinventory's People

Contributors

rheimbeck 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.