def post(self, story_id, task): """Create a new task. :param story_id: An ID of the story. :param task: a task within the request body. """ if not task.story_id: task.story_id = story_id if task.story_id != story_id: abort(400, _("URL story_id and task.story_id do not match")) task = task_is_valid_post(task) creator_id = request.current_user_id task.creator_id = creator_id # We can't set due dates when creating tasks at the moment. task_dict = task.as_dict() if "due_dates" in task_dict: del task_dict['due_dates'] created_task = tasks_api.task_create(task_dict) events_api.task_created_event(story_id=task.story_id, task_id=created_task.id, task_title=created_task.title, author_id=creator_id) return wmodels.Task.from_db_model(created_task)
def post(self, task): """Create a new task. Example:: curl https://my.example.org/api/v1/tasks \\ -H 'Authorization: Bearer MY_ACCESS_TOKEN' \\ -H 'Content-Type: application/json;charset=UTF-8' \\ --data-binary '{"story_id":19,"title":"Task Foo",\\ "project_id":153,"status":"todo"}' :param task: a task within the request body. """ task = task_is_valid_post(task) creator_id = request.current_user_id task.creator_id = creator_id # We can't set due dates when creating tasks at the moment. task_dict = task.as_dict() if "due_dates" in task_dict: del task_dict['due_dates'] created_task = tasks_api.task_create(task_dict) events_api.task_created_event(story_id=task.story_id, task_id=created_task.id, task_title=created_task.title, author_id=creator_id) return wmodels.Task.from_db_model(created_task)
def post(self, story_id, task): """Create a new task. Example:: curl 'https://my.example.org/api/v1/stories/19/tasks' \\ -H 'Authorization: Bearer MY_ACCESS_TOKEN' \\ -H 'Content-Type: application/json;charset=UTF-8' \\ --data-binary '{"title":"Task Foo","project_id":153,"key":"todo"}' :param story_id: An ID of the story. :param task: a task within the request body. """ if not task.story_id: task.story_id = story_id if task.story_id != story_id: abort(400, _("URL story_id and task.story_id do not match")) task = task_is_valid_post(task) creator_id = request.current_user_id task.creator_id = creator_id # We can't set due dates when creating tasks at the moment. task_dict = task.as_dict() if "due_dates" in task_dict: del task_dict['due_dates'] created_task = tasks_api.task_create(task_dict) events_api.task_created_event(story_id=task.story_id, task_id=created_task.id, task_title=created_task.title, author_id=creator_id) return wmodels.Task.from_db_model(created_task)
def post(self, task): """Create a new task. :param task: a task within the request body. """ task = task_is_valid_post(task) creator_id = request.current_user_id task.creator_id = creator_id # We can't set due dates when creating tasks at the moment. task_dict = task.as_dict() if "due_dates" in task_dict: del task_dict['due_dates'] created_task = tasks_api.task_create(task_dict) events_api.task_created_event(story_id=task.story_id, task_id=created_task.id, task_title=created_task.title, author_id=creator_id) return wmodels.Task.from_db_model(created_task)