Skip to content

Commit

Permalink
feat: added supplier name to raw_materials resource
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbpro committed Apr 24, 2021
1 parent e8b3dfd commit e986025
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions resources/raw_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RawMaterial(Resource):
parser.add_argument('unit_material',type=str,required=False)
parser.add_argument('stock_amt',type=int,required=False)
parser.add_argument('sell_by_date',type=str,required=False)
parser.add_argument('supplier_name',type=str,required=False)

# handles HTTP GET /raw_materials/<int:id>
def get(self, id):
Expand Down Expand Up @@ -59,6 +60,8 @@ def put(self, id):
raw_material.stock_amt = data['stock_amt']
if key=='sell_by_date':
raw_material.sell_by_date = data['sell_by_date']
if key=='supplier_name':
raw_material.supplier_name = data['supplier_name']

raw_material.last_update = datetime.now().strftime("%d/%m/%Y %H:%M")

Expand Down Expand Up @@ -89,6 +92,7 @@ class RawMaterials(Resource):
parser.add_argument('unit_material',type=str,required=False)
parser.add_argument('stock_amt',type=int,required=False)
parser.add_argument('sell_by_date',type=str,required=False)
parser.add_argument('supplier_name',type=str,required=False)

# handles HTTTP request GET /raw_materials
def get(self):
Expand Down

0 comments on commit e986025

Please sign in to comment.