def mutate(cls, _, info, title, milestones, type, expiration): user = User.objects(email=get_jwt_identity()).first() if not user: return NewToDoMutation( ResponseMessageField(is_success=False, message="User not found")) type_enum = {1: "INFINITY", 2: "STANDARD", 3: "HARD"} type = type_enum.get(type, None) new_todo = ToDo( title=title, type=str(type), milestones=[Milestone(id=uuid4().hex, name=m) for m in milestones], expiration=expiration) new_todo.save() user.update_one(inc__point=30) user.update_one(push__todo=new_todo) todo_activity_logger(user=user, type="new") return NewToDoMutation( ResponseMessageField(is_success=True, message="Todo upload success"))
def save(): todo = ToDo(content="study flask") todo.save()
def save(): todo = ToDo(content = "study flask") todo.save()