| 12345678910111213141516171819202122232425262728 |
- using Application.Abstractions.Messaging;
- using Web.Api.Common;
- using Web.Api.Extensions;
- namespace Web.Api.Endpoints.Forum.PostCheer;
- // 글의 응원 합계 + 최근 N건 조회 — D3 M4. 익명 허용 (응원 표시는 열람 조건이 아님).
- internal sealed class Get : IEndpoint
- {
- public void MapEndpoint(IEndpointRouteBuilder app)
- {
- app.MapGet("api/posts/{postID}/cheers", async (
- int postID,
- int? take,
- ISender sender,
- CancellationToken ct
- ) => {
- var result = await sender.Send(new Application.Features.Api.Forum.PostCheer.Get.Query(postID, take ?? 20), ct);
- return result.Match(
- data => ApiResponse.Ok(data),
- CustomResults.Problem
- );
- })
- .WithTags("Forum")
- .AllowAnonymous();
- }
- }
|