public async Task <IActionResult> SearchInDatasource(string datasourceId, [FromBody] SearchArticlesInDataSourceQuery searchArticlesInFeedQuery, CancellationToken cancellationToken)
        {
            var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            searchArticlesInFeedQuery.UserId       = userId;
            searchArticlesInFeedQuery.DataSourceId = datasourceId;
            var result = await _mediator.Send(searchArticlesInFeedQuery, cancellationToken);

            return(new OkObjectResult(result));
        }
        public async Task <SearchQueryResult <ArticleQueryResult> > Handle(SearchArticlesInDataSourceQuery request, CancellationToken cancellationToken)
        {
            var dataSource = await _dataSouceQueryRepository.Get(new List <string> {
                request.DataSourceId
            }, cancellationToken);

            if (dataSource == null)
            {
                _logger.LogError($"the datasource {request.DataSourceId} doesn't exist");
                throw new NewsAggregatorResourceNotFoundException(string.Format(Global.DataSourceDoesntExist, request.DataSourceId));
            }

            return(await _articleQueryRepository.SearchInDataSource(new SearchArticlesInDataSourceParameter
            {
                Count = request.Count,
                DataSourceId = request.DataSourceId,
                Direction = request.Direction,
                Order = request.Order,
                StartIndex = request.StartIndex,
                UserId = request.UserId
            }, cancellationToken));
        }