public IActionResult GetAll([FromRoute] Guid account_id, [FromRoute] Guid project_id, [FromRoute] Guid sprint_id)
 {
     try
     {
         _permission.EnsureProjectMember(account_id, project_id);
         _sprint.EnsureExisted(project_id, sprint_id);
         return(Ok(_workflow.GetAll(sprint_id)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }
示例#2
0
 public IActionResult GetDetail([FromRoute] Guid project_id, [FromRoute] Guid sprint_id)
 {
     try
     {
         JwtClaimM jwt_claim = _jwtAuth.GetClaims(Request);
         _permission.EnsureProjectManager(jwt_claim.UserId, project_id);
         _sprint.EnsureExisted(project_id, sprint_id);
         return(Ok(_sprint.GetDetail(sprint_id)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }
        public IActionResult GetTask([FromRoute] Guid project_id, [FromRoute] Guid sprint_id, [FromQuery] string task = "my_task")
        {
            try
            {
                JwtClaimM jwt_claim = _jwtAuth.GetClaims(Request);
                switch (task)
                {
                case "all_task":
                    _permission.EnsureProjectManager(jwt_claim.UserId, project_id);
                    _sprint.EnsureExisted(project_id, sprint_id);
                    return(Ok(_task.GetAll(sprint_id)));

                case "my_task":
                    _permission.EnsureProjectMember(jwt_claim.UserId, project_id);
                    _sprint.EnsureExisted(project_id, sprint_id);
                    return(Ok(_task.GetAllMyTask(sprint_id, jwt_claim.UserId)));

                case "submitted_task":
                    _permission.EnsureTester(jwt_claim.UserId, project_id);
                    _sprint.EnsureExisted(project_id, sprint_id);
                    return(Ok(_task.GetSubmittedTask(sprint_id)));
                }

                return(BadRequest(new HttpResponseError {
                    StatusCode = 400,
                    Detail = new HttpResponseErrorDetail
                    {
                        Message = "Unable to execute the request!",
                        InnerMessage = "Parameter 'task' must have value of 'all_task', 'my_task' or 'submitted_task'"
                    }
                }));
            }
            catch (Exception e)
            {
                return(GetError(e));
            }
        }
 public IActionResult SubmitTasks([FromRoute] Guid project_id, [FromRoute] Guid sprint_id, [FromBody] TasksSubmissionM model)
 {
     try
     {
         JwtClaimM jwt_claim = _jwtAuth.GetClaims(Request);
         _permission.EnsureProjectMember(jwt_claim.UserId, project_id);
         _sprint.EnsureExisted(project_id, sprint_id);
         _commit.EnsureExisted(jwt_claim.UserId, model.CommitId);
         return(Ok(_submission.SubmitTasks(jwt_claim.UserId, sprint_id, model.CommitId, model.TaskIds)));
     }
     catch (Exception e)
     {
         return(GetError(e));
     }
 }