GetLedger.cs 950 B

12345678910111213141516171819202122232425262728293031
  1. using System.Security.Claims;
  2. using Application.Abstractions.Messaging;
  3. using Web.Api.Common;
  4. using Web.Api.Extensions;
  5. namespace Web.Api.Endpoints.Paper;
  6. /// <summary>모의투자 — 입출금 내역.</summary>
  7. internal sealed class GetLedger : IEndpoint
  8. {
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. app.MapGet("api/paper/ledger", async (
  12. int? page,
  13. ushort? perPage,
  14. ClaimsPrincipal user,
  15. ISender sender,
  16. CancellationToken ct
  17. ) => {
  18. var memberID = user.GetRequiredMemberID();
  19. var data = await sender.Send(new Application.Features.Api.Paper.GetLedger.Query(
  20. memberID,
  21. page is > 0 ? page.Value : 1,
  22. perPage is > 0 ? perPage.Value : (ushort)20
  23. ), ct);
  24. return ApiResponse.Ok(data);
  25. })
  26. .WithTags("Paper")
  27. .RequireAuthorization();
  28. }
  29. }