Skip to content

Commit

Permalink
#14 docs for feed endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mgroves committed Sep 19, 2023
1 parent a8adcbd commit dcf5af3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Conduit/Conduit.Web/Articles/Controllers/ArticlesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ public async Task<IActionResult> Delete(string slug)
/// <remarks>
/// <a href="https://realworld-docs.netlify.app/docs/specs/backend-specs/endpoints#list-articles">Conduit spec for List Articles Endpoint</a>
/// </remarks>
/// <param name="filter"></param>
/// <param name="filter">Filtering options</param>
/// <returns>List of articles</returns>
/// <response code="200">Successfully queryies articles</response>
/// <response code="200">Successfully queryied articles</response>
/// <response code="422">Article request is invalid</response>
[HttpGet]
[Route("/api/articles")]
Expand Down Expand Up @@ -272,15 +272,25 @@ public async Task<IActionResult> GetArticles([FromQuery] ArticleFilterOptionsMod
return Ok(new { articles = getArticlesResponse.ArticlesView });
}

/// <summary>
/// Feed (latest articles created by users that the logged-in user follows)
/// </summary>
/// <remarks>
/// <a href="https://realworld-docs.netlify.app/docs/specs/backend-specs/endpoints#feed-articles">Conduit spec for Feed Articles Endpoint</a>
/// </remarks>
/// <param name="options">Options</param>
/// <returns>List of articles</returns>
/// <response code="200">Successfully queryied articles</response>
/// <response code="422">Article request is invalid</response>
[HttpGet]
[Route("/api/articles/feed")]
public async Task<IActionResult> GetFeed([FromQuery] ArticleFeedOptionsModel filter)
public async Task<IActionResult> GetFeed([FromQuery] ArticleFeedOptionsModel options)
{
// get auth info
var claims = _authService.GetAllAuthInfo(Request.Headers["Authorization"]);
var username = claims.Username.Value;

var getArticlesRequest = new GetFeedRequest(username, filter);
var getArticlesRequest = new GetFeedRequest(username, options);
var getArticlesResponse = await _mediator.Send(getArticlesRequest);

if (getArticlesResponse.IsFailure)
Expand Down

0 comments on commit dcf5af3

Please sign in to comment.