public async Task <IActionResult> GetDomains(DomainSearchRequest domainSearch) { ValidationResult validationResult = await _domainSearchValidator.ValidateAsync(domainSearch); if (!validationResult.IsValid) { _log.LogWarning($"Bad request: {validationResult.GetErrorString()}"); return(BadRequest(new ErrorResponse(validationResult.GetErrorString()))); } Claim roleClaim = User.FindFirst(_ => _.Type == ClaimTypes.Role); if (roleClaim.Value == RoleType.Unauthorised) { return(Forbid()); } int userId = GetUserId(User); MatchingDomains result = await _domainsDao.GetMatchingDomains(userId, domainSearch.SearchPattern); return(new ObjectResult(result)); }
public DomainSearchResponse(MatchingDomains matches) { Matches = matches; }
protected override async Task <DomainSearchResponse> CreateInternalResponseAsync(DomainSearchRequest request) { MatchingDomains matchingDomains = await _aggregateReportApiDao.GetMatchingDomains(request.SearchPattern); return(new DomainSearchResponse(matchingDomains)); }