def update_plan_cdl(account_id, plan_id): try: dao = PlanDao(content, account_id) plan = dao.retrieve(plan_id) plan.cdl = request.data dao.save(plan) return plan.cdl, 200 except Exception as e: raise InvalidUsage(str(e))
def plan_update(account_id, plan_id): try: dao = PlanDao(content, account_id) plan = dao.retrieve(plan_id) plan = dao.from_json(request.data) if plan_id != plan.plan_id: raise Exception("Cannot change the plan ID") dao.save(plan) except Exception as e: raise InvalidUsage(str(e)) return dao.get_schema().dumps(plan, indent=2), 200