Link to live app: https://stock-em.vercel.app/
Link to Client Repo: https://github.com/juliawithers/stock-em
The database is hosted on the heroku database addon. There are six tables:
*User table is not yet implemented.
USERS
id | username | passw |
---|---|---|
id - primary key | some username - not null | hashed password - not null |
INVENTORIES
id | user_id | sku | quantity | inv_description | inv_location | date_entered |
---|---|---|---|---|---|---|
id - primary key | user id - integer not null | sku - text not null | quantity - integer not null | material description - text | material location - text | date added to inventory - text not null |
SUPPLIERS
id | user_id | company | contact | phone | sup_address | |
---|---|---|---|---|---|---|
id - primary key | user id - integer not null | supplier company name - text not null | supplier contact name - text not null | supplier contact phone - text not null | supplier contact email - text not null | supplier address - text not null |
CUSTOMERS
id | user_id | company | contact | phone | bill_address | ship_address | |
---|---|---|---|---|---|---|---|
id - primary key | user id - integer not null | customer company name - text not null | customer contact name - text not null | customer contact phone - text not null | customer contact email - text not null | customer billing address - text not null | customer ship-to address - text not null |
ORDERS
id | user_id | company | sku | quantity | inv_description | cust_order | sup_order | date_entered |
---|---|---|---|---|---|---|---|---|
id - primary key | user id - integer not null | company name - text not null | sku - text not null | quantity - integer not null | material description - text | customer order - text | supplier order - text | date submitted - text |
SKUS
id | user_id | sku | inv_description | date_entered |
---|---|---|---|---|
id - primary key | user id - integer not null | sku - text not null | material description - text | date submitted - text |
Please see the endpoints and schemas below:
`https://stock-em-api.herokuapp.com/api/stock-em`
/inventory
/suppliers
/customers
/past_orders
/skus
GET: request query:
`https://stock-em-api.herokuapp.com/api/stock-em/inventory/?user_id=${user_id}`
returns:
[{
"id": 1,
"sku": 1234,
"quantity": 25,
"inv_description": "capacitor",
"inv_location": "M01",
"date_entered": "2020-5-5"
},...]
POST:
body:
{
"sku": 1234,
"quantity": 25,
"inv_description": "capacitor",
"inv_location": "M01",
"date_entered": "2020-5-5"
}
returns:
{
"id": "newid",
"sku": 1234,
"quantity": 25,
"inv_description": "capacitor",
"inv_location": "M01",
"date_entered": "2020-5-5"
}
DELETE:
body:
{
"id": the inventory id
}
returns:
{
"id": deleted id
}
GET:
query params:
`https://stock-em-api.herokuapp.com/api/stock-em/suppliers/?user_id=${user_id}`
returns:
[
{
"id": 1,
"company": "Company 1",
"contact": "John Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"sup_address": "1234 Main St., Nowhere USA"
},...
]
POST:
body:
{
"company": "Company 1",
"contact": "John Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"sup_address": "1234 Main St., Nowhere USA"
}
returns:
{
"id": new id,
"company": "Company 1",
"contact": "John Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"sup_address": "1234 Main St., Nowhere USA"
}
PATCH:
body:
{
"id": id,
"company": "UPDATED COMPANY",
"contact": "John Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"sup_address": "1234 Main St., Nowhere USA"
}
returns:
{
"id": id,
"company": "UPDATED COMPANY",
"contact": "John Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"sup_address": "1234 Main St., Nowhere USA"
}
GET:
query params:
`https://stock-em-api.herokuapp.com/api/stock-em/customers/?user_id=${user_id}`
returns:
[
{
"id": 1,
"company": "Company 1",
"contact": "Jane Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"bill_address": "1234 Main St., Nowhere USA",
"ship_address": "1234 Main St., Nowhere USA"
},...
]
POST :
body:
{
"company": "Company 1",
"contact": "Jane Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"bill_address": "1234 Main St., Nowhere USA",
"ship_address": "1234 Main St., Nowhere USA"
}
returns:
{
"id": new id,
"company": "Company 1",
"contact": "Jane Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"bill_address": "1234 Main St., Nowhere USA",
"ship_address": "1234 Main St., Nowhere USA"
}
PATCH:
body:
{
"id": 1,
"company": "UPDATED CUSTOMER COMPANY",
"contact": "Jane Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"bill_address": "1234 Main St., Nowhere USA",
"ship_address": "1234 Main St., Nowhere USA"
}
returns:
{
"id": 1,
"company": "UPDATED CUSTOMER COMPANY",
"contact": "Jane Doe",
"phone": "111-111-1112",
"email": "[email protected]",
"bill_address": "1234 Main St., Nowhere USA",
"ship_address": "1234 Main St., Nowhere USA"
}
GET:
query params:
`https://stock-em-api.herokuapp.com/api/stock-em/past-orders/?user_id=${user_id}`
returns:
[
{
"id": 1,
"company":"Some Company",
"sku": 1234,
"quantity": 100,
"inv_description": "capacitor",
"cust_order": "PO123",
"sup_order": "",
"date_entered": "2020-1-1"
},...
]
POST:
body:
{
"company":"Some Company",
"sku": 1234,
"quantity": 100,
"inv_description": "capacitor",
"cust_order": "PO123",
"sup_order": "",
"date_entered": "2020-1-1"
}
returns:
{
"id": new id,
"company":"Some Company",
"sku": 1234,
"quantity": 100,
"inv_description": "capacitor",
"cust_order": "PO123",
"sup_order": "",
"date_entered": "2020-1-1"
}
GET:
query params:
`https://stock-em-api.herokuapp.com/api/stock-em/skus/?user_id=${user_id}`
returns:
[
{
"id": 1,
"sku": 1234,
"inv_description": "capacitor",
"date_entered": "2020-5-5"
},...
]
POST:
body:
{
"sku": 1234,
"inv_description": "capacitor",
"date_entered": "2020-5-5"
}
returns:
{
"id": new id,
"sku": 1234,
"inv_description": "capacitor",
"date_entered": "2020-5-5"
},