Example #1
0
 def deleteCash(self, cashid):
     dao = CashDAO()
     if not dao.getCashById(cashid):
         return jsonify(Error="Cash not found."), 404
     else:
         dao.deleteCash(cashid)
         return jsonify(DeleteStatus="OK"), 200
Example #2
0
 def insertCash(self, form):
     if len(form) != 1:
         return jsonify(Error="Malformed post request"), 400
     else:
         dao = CashDAO()
         rid = form['rid']
         cashid = dao.insertCash(rid)
         result = self.build_cashes_attributes(cashid)
         return jsonify(Cash=result), 201
Example #3
0
 def getCashesByOrder(self, oid):
     dao = CashDAO()
     cashes_list = dao.getCashesByOrder(oid)
     result_list = []
     for row in cashes_list:
         result = self.build_cashes_dict(row)
         result_list.append(result)
     if not result_list:
         return jsonify(Error="Cash Not Found"), 404
     else:
         return jsonify(Cashes=result_list)