def put(cls, id): task_json = request.get_json()["task"] task = TaskModel.find_by_id(id) if task: task.customer_id = task_json["customer_id"] task.planogram_id = task_json["planogram_id"] task.start_before = task_json["start_before"] task.complete_before = task_json["complete_before"] task.agent_id = task_json.get("agent_id") task.save_to_db() return { "message": "task updated", "task": { **task_schema.dump(task), "customer": task.customer.name, "planogram": task.planogram.name, "agent": task.agent.first_name if task.agent else None, "agentData": agent_schema.dump(task.agent) } } return {"message": "not found"}, 404
def get(cls, id): task = TaskModel.find_by_id(id) if task: return task_schema.dump(task) return {"message": "not found"}, 404