Skip to content

Commit

Permalink
merge(#18): fix routing conflict in discussions controller
Browse files Browse the repository at this point in the history
  • Loading branch information
undrcrxwn committed Jan 30, 2024
2 parents 6b6d61a + 40467dd commit 04159b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,13 @@ public class DiscussionsController : ControllerBase
public async Task<DiscussionDto> GetDiscussionById([FromRoute] Guid discussionId) =>
await _discussions.GetByIdAsync(discussionId);

/// <summary>
/// Returns all discussions.
/// </summary>
[HttpGet]
public async Task<IEnumerable<DiscussionDto>> GetAllDiscussions() =>
await _discussions.GetAllAsync();

/// <summary>
/// Returns all discussions created by author with the specified ID.
/// </summary>
[HttpGet]
public async Task<IEnumerable<DiscussionDto>> GetDiscussionsByAuthor([FromQuery] Guid authorId) =>
await _discussions.GetByAuthorAsync(authorId);
public async Task<IEnumerable<DiscussionDto>> GetDiscussions([FromQuery] Guid? authorId) => authorId is null
? await _discussions.GetAllAsync()
: await _discussions.GetByAuthorAsync(authorId.Value);

/// <summary>
/// Creates a discussion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<IEnumerable<DiscussionDto>> GetAllAsync() => await _graphClien
{
Id: d.Id,
Title: d.Title,
Description: d.Description
Description: d.Description,
Author: {
Id: a.Id,
Username: a.Username,
Expand Down

0 comments on commit 04159b0

Please sign in to comment.