History.cs 905 B

123456789101112131415161718192021222324252627282930
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. using System.Security.Claims;
  5. namespace Web.Api.Endpoints.Donation;
  6. /// <summary>후원 내역</summary>
  7. internal sealed class History : IEndpoint
  8. {
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. /// 후원 내역 조회 (type: "sent"=보낸 / "received"=받은, 페이징)
  12. app.MapGet("api/donation/history", async (
  13. string type,
  14. int page,
  15. ushort perPage,
  16. ClaimsPrincipal user,
  17. ISender sender,
  18. CancellationToken ct
  19. ) => {
  20. var memberID = user.GetRequiredMemberID();
  21. var data = await sender.Send(new Application.Features.Api.Donation.History.Query(memberID, type, page, perPage), ct);
  22. return ApiResponse.Ok(data);
  23. })
  24. .WithTags("Donation")
  25. .RequireAuthorization();
  26. }
  27. }