// [Cached(600)] public async Task <IActionResult> GetProjectMaintainerByUserProject([FromRoute] string username, [FromRoute] string projectName, [FromRoute] string maintainerUserName, [FromQuery] GetAllProjectMaintainersQuery query, [FromQuery] PaginationQuery paginationQuery) { var user = await _userService.GetUserByUserNameAsync(username).ConfigureAwait(false); if (user == null) { return(NotFound()); } var project = await _projectService.GetProjectByUserAsync(username, projectName).ConfigureAwait(false); if (project == null) { return(NotFound()); } var pagination = _mapper.Map <PaginationFilter>(paginationQuery); // var filter = _mapper.Map<GetAllProjectMaintainersFilter>(query); var maintainer = await _projectMaintainerService.GetProjectMaintainerAsync(project.Id, maintainerUserName).ConfigureAwait(false); var maintainerResponse = _mapper.Map <DragonflyUserResponse>(maintainer); return(Ok(maintainerResponse)); }
// [Cached(600)] public async Task <IActionResult> GetAllProjectMaintainersByUserProject([FromRoute] string username, [FromRoute] string projectName, [FromQuery] GetAllProjectMaintainersQuery query, [FromQuery] PaginationQuery paginationQuery) { var user = await _userService.GetUserByUserNameAsync(username).ConfigureAwait(false); if (user == null) { return(NotFound()); } var project = await _projectService.GetProjectByUserAsync(username, projectName).ConfigureAwait(false); if (project == null) { return(NotFound()); } var pagination = _mapper.Map <PaginationFilter>(paginationQuery); // var filter = _mapper.Map<GetAllProjectMaintainersFilter>(query); var(list, count) = await _projectMaintainerService.GetAllProjectMaintainersAsync(project.Id, pagination).ConfigureAwait(false); var maintainersResponse = _mapper.Map <List <DragonflyUserResponse> >(list); if (pagination == null || pagination.PageNumber < 1 || pagination.PageSize < 1) { return(Ok(new PagedResponse <DragonflyUserResponse>(maintainersResponse, count))); } var paginationResponse = PaginationHelpers.CreatePaginatedResponse(_uriService, pagination, maintainersResponse, count); return(Ok(paginationResponse)); }