def delete_movie(): """ Delete movie by id """ data = get_request_data() if 'id' in data.keys(): try: row_id = int(data['id']) Movie.delete(row_id) except: err = 'Id must be integer' return make_response(jsonify(error=err), 400) msg = 'Record successfully deleted' return make_response(jsonify(message=msg), 200)
def delete_movie(): """ Delete movie by id """ data = get_request_data() if 'id' in data.keys(): try: row_id = int(data['id']) except: err = 'Id must be integer' return make_response(jsonify(error=err), 400) if Movie.delete(row_id): msg = 'Record successfully deleted' return make_response(jsonify(message=msg), 200) else: err = 'Record with such id does not exist' return make_response(jsonify(error=err), 400) else: err = 'No id specified' return make_response(jsonify(error=err), 400)