Example #1
0
 def updateReport(self, id, fieldsToUpdate, params):
     # update the report with the specified id, indicating which fields to update and what to update them to
     db.updateObject('reports', id, fieldsToUpdate, params)
     # retrieve the newly updated report and create an object from it's data
     reportTuple = db.getObjectById('reports', id)[0]
     report = Report(reportTuple[0], self.__getCar(reportTuple[1]), reportTuple[2], reportTuple[3])
     # jsonify the report to confirm the update
     return jsonify({'report': report.asDict()})
Example #2
0
 def createReport(self, params):
     # construct a report object from the gathered data
     report = Report(params[0], self.__getCar(params[1]), params[2], params[3])
     # update the database with the new report and respond with a confirmation of insertion
     db.insertObject('reports', Report.attributesAsList(), report.asTuple())
     return jsonify({'report': report.asDict()}), 201