public async Task <IActionResult> GetMany([FromQuery] CommentSearchParams searchParams) { if (!BaseHelpers.IsPaginatonSearchParamsValid(searchParams, out ErrorResponse errorResponse)) { return(new BadRequestObjectResult(errorResponse)); } FilteredDataViewModel <CommentViewModel> result = await _mediator.Send(new GetCommentsQuery(searchParams)); return(Ok(new FilteredResponse <CommentViewModel>(searchParams) { Data = result.Data, Count = result.Count, })); }
public async Task <IActionResult> NewsFeed([FromQuery] PostSearchParams searchParams) { if (!BaseHelpers.IsPaginatonSearchParamsValid(searchParams, out ErrorResponse errorResponse)) { return(new BadRequestObjectResult(errorResponse)); } string userId = _httpContext.User.FindFirstValue("sub"); FilteredDataViewModel <PostViewModel> result = await _mediator.Send(new GetNewsFeedQuery(userId, searchParams)); return(Ok(new FilteredResponse <PostViewModel>(searchParams) { Data = result.Data, Count = result.Count, })); }