Ejemplo n.º 1
0
        public async Task <IActionResult> GetSearchResults(AllEntitiesSearchRequest request)
        {
            ValidationResult validationResult = _searhLimitRequestValidator.Validate(request);

            if (!validationResult.IsValid)
            {
                string email = User.FindFirst(_ => _.Type == ClaimTypes.Email)?.Value;
                _log.LogWarning($"User {email} made bad request: {validationResult.GetErrorString()}");
                return(BadRequest(new ErrorResponse(validationResult.GetErrorString())));
            }

            SearchResult searchResult = await _searchDao.GetSearchResults(request.Search, request.Limit);

            return(new ObjectResult(searchResult));
        }