Skip to content

Commit cac0e46

Browse files
authored
merge(#37): allow discussion comments flattening and fix OpenAPI response type
2 parents a143b74 + c1cecf6 commit cac0e46

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/CrowdParlay.Social.Api/v1/Controllers/DiscussionsController.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,20 @@ public async Task<Page<DiscussionResponse>> Search(
5252
/// Retrieves top-level comments for a specified discussion with pagination.
5353
/// </summary>
5454
/// <param name="discussionId">The unique identifier of the discussion.</param>
55+
/// <param name="flatten">When true, returns all nested replies in a flat structure; otherwise returns direct children only.</param>
5556
/// <param name="offset">The number of items to skip before starting to return results (pagination offset).</param>
5657
/// <param name="count">The maximum number of items to return (pagination limit).</param>
5758
/// <returns>A paginated list of top-level comments in the discussion.</returns>
5859
[HttpGet("{discussionId}/comments")]
5960
[Consumes(MediaTypeNames.Application.Json), Produces(MediaTypeNames.Application.Json)]
60-
[ProducesResponseType<Page<DiscussionResponse>>(Status200OK)]
61+
[ProducesResponseType<Page<CommentResponse>>(Status200OK)]
6162
[ProducesResponseType<ProblemDetails>(Status500InternalServerError)]
6263
public async Task<Page<CommentResponse>> GetComments(
6364
[FromRoute] string discussionId,
65+
[FromQuery, BindRequired] bool flatten,
6466
[FromQuery, BindRequired] int offset,
6567
[FromQuery, BindRequired] int count) =>
66-
await commentsService.GetRepliesAsync(discussionId, false, User.GetUserId(), offset, count);
68+
await commentsService.GetRepliesAsync(discussionId, flatten, User.GetUserId(), offset, count);
6769

6870
/// <summary>
6971
/// Creates a new top-level comment in a discussion. Requires authenticated user and triggers real-time notifications.

0 commit comments

Comments
 (0)