Beispiel #1
0
        public async Task <IActionResult> TicketSummaryGetAll([FromQuery] GetTicketSummaryRequest request)
        {
            var keyAuthResult = await _authService.AuthByApiKey();

            if (keyAuthResult.User == null)
            {
                return(BadRequest(ErrorResponse.GetErrorList(keyAuthResult.ErrorText)));
            }

            var ticketSmalls = _ticketService.GetTicketsSmall(request.ProjectName, request.Type, request.State);
            var response     = _mapper.Map <List <TicketSummaryResponse> >(ticketSmalls);

            return(Ok(response));
        }
        public async Task <IActionResult> ProjectSummaryGetAll()
        {
            var keyAuthResult = await _authService.AuthByApiKey();

            if (keyAuthResult.User == null)
            {
                return(BadRequest(ErrorResponse.GetErrorList(keyAuthResult.ErrorText)));
            }

            var projSummaries = _ticketService.GetProjectSummaries();
            var response      = _mapper.Map <List <ProjectSummaryResponse> >(projSummaries);

            return(Ok(response));
        }
Beispiel #3
0
        public async Task <IActionResult> UserRoleByProjectGet([FromRoute] string projectName)
        {
            var keyAuthResult = await _authService.AuthByApiKey();

            if (keyAuthResult.User == null)
            {
                return(BadRequest(ErrorResponse.GetErrorList(keyAuthResult.ErrorText)));
            }

            var userRoles = await _projectRoleService.GetUsersWithProjectRoleForProject(projectName);

            var response = _mapper.Map <List <UserRoleResponse> >(userRoles.projectUser);

            return(Ok(response));
        }
Beispiel #4
0
        public async Task <IActionResult> CommentGetAll([FromRoute] long ticketId)
        {
            var keyAuthResult = await _authService.AuthByApiKey();

            if (keyAuthResult.User == null)
            {
                return(BadRequest(ErrorResponse.GetErrorList(keyAuthResult.ErrorText)));
            }

            var ticket = _ticketService.GetTicket(ticketId);

            if (ticket == null)
            {
                return(NotFound(ErrorResponse.GetErrorList($"Ticket with Id: {ticketId} was not found")));
            }

            var response = _mapper.Map <List <CommentResponse> >(ticket.Comments);

            return(Ok(response));
        }