Final Wings T1 Assessment

You might also like

You are on page 1of 1

========= Backend ======================

/products/get/None
show all items
/products/get/InStock
show items with stock > 0
/products/get/OutOfStock
show items with stock == 0

/product/save
update if body has id
otherwise create new and add

axios

Browser Router
for on click navigation

========= App.js =======================


Do Routing
1. /add -> ProductSaveComp
2. /update/:item -> ProductSaveComp
3. / -> redirect to /home/farmer
4. /home/:user-type -> UserHomepageComp (usertype=farmer/customer)

======== ProductSaveComp ===============


Form
1. name(string),priceperunit(number),stock(number),type(kg,ton,count)
2. error Invalid name,Invalid stock,Invalid Price
3. do post and update using axios
4. state = {product:[], name:'' , pricePerUnit:'', stock:'', type:'' }

========== UserHomepage ================

display UserviewComp here

========= UserviewComp =================


get using axios
display data in table
1. + btn redirect to ProductSaveComp /add
2. name price stock available edit-button
eg: Bag 2000 0 OutofStock Edit
eg: Bag 2000 10 InStock Edit

3. edit button redirect to ProductSaveComp with data /update/:item


4. if no data show no records
5. under stock column show inStock(for stock > 0) and Outofstock(for stock = 0)
6. one dropdown(None/instock/outstock) do get using axios according to option
selected

You might also like