Write README.md

This commit is contained in:
BBaoVanC 2020-10-16 18:56:31 -05:00
parent 175c464f66
commit 3060a9fafb
No known key found for this signature in database
GPG Key ID: 6D74C8B0E7D791C2

202
README.md
View File

@ -1,3 +1,203 @@
# InvMan
Inventory Manager
## Table of Contents
1. [What is InvMan?](#what-is-invman)
2. [API Usage](#api-usage)
1. [GET Requests](#get-requests-getting-information)
2. [POST Requests](#post-requests-creating-objects)
## What is InvMan?
InvMan is a Flask app which provides a web API and web UI to keep inventory using a PostgreSQL backend.
---
## API Usage
### GET requests (getting information)
---
Please keep in mind:
* Text surrounded by `[` and `]` are parameters which should be replaced.
* Names are case-sensitive.
Get a list of locations
```plaintext
GET /api/v1/locations
```
Get information about a location
```plaintext
GET /api/v1/location/name/[location-name]
```
Get the quantities of all products at a location
```plaintext
GET /api/v1/location/[location-name]/quantities
```
Get the quantity of a product (by UPC) at a location
```plaintext
GET /api/v1/location/[location-name]/quantity/upc/[product-upc]
```
Get the quantity of a product (by name) at a location
```plaintext
GET /api/v1/location/[location-name]/quantity/name/[product-name]
```
Get a list of products
```plaintext
GET /api/v1/products
```
Get information about a product (by UPC)
```plaintext
GET /api/v1/product/upc/[product-upc]
```
Get information about a product (by name)
```plaintext
GET /api/v1/product/name/[product-name]
```
Get a list of brands
```plaintext
GET /api/v1/brands
```
Get information about a brand
```plaintext
GET /api/v1/brand/name/[brand-name]
```
Get a list of units
```plaintext
GET /api/v1/units
```
Get information about a unit (by name)
```plaintext
GET /api/v1/unit/name/[unit-name]
```
Get a list of purchases
```plaintext
GET /api/v1/purchases
```
Get information about a purchase (by id)
```plaintext
GET /api/v1/purchase/id/[purchase-id]
```
Get a list of uses
```plaintext
GET /api/v1/uses
```
Get information about a use (by id)
```plaintext
GET /api/v1/purchase/id/[use-id]
```
### POST Requests (creating objects)
---
Create a location
```plaintext
POST /api/v1/create_location
```
Request form:
| Argument Name | Description | Required? |
| ------------- | --------------------------- | --------- |
| name | Name of the location | Yes |
| description | Description of the location | No |
---
Create a brand
```plaintext
POST /api/v1/create_brand
```
Request form:
| Argument Name | Description | Required? |
| ------------- | ------------------------ | --------- |
| name | Name of the brand | Yes |
| description | Description of the brand | No |
---
Create a unit
```plaintext
POST /api/v1/create_unit
```
Request form:
| Argument Name | Description | Required? |
| ------------- | ----------------------- | --------- |
| name | Name of the unit | Yes |
| description | Description of the unit | No |
---
Create a product
```plaintext
POST /api/v1/create_product
```
Request form:
| Argument Name | Description | Required? |
| ------------- | ----------------------------- | --------- |
| upc | UPC of the product | Yes |
| brand | Brand which makes the product | Yes |
| name | Name of the product | Yes |
| size | Size of the product | Yes |
| sizeunit | Unit used in `size` | Yes |
| description | Description of the product | No |
---
Create a purchase
```plaintext
POST /api/v1/create_purchase
```
| Argument Name | Description | Required? |
| ------------- | -------------------------------------- | --------- |
| upc | UPC of the product which was purchased | Yes |
| quantity | Quantity of the product purchased | Yes |
| date | Date of this purchase | Yes |
| location | Location to link this purchase to | Yes |
---
Create a use
```plaintext
POST /api/v1/create_use
```
| Argument Name | Description | Required? |
| ------------- | --------------------------------- | --------- |
| upc | UPC of the product which was used | Yes |
| quantity | Quantity of the product used | Yes |
| date | Date of this usage | Yes |
| location | Location to link this usage to | Yes |