ExchangeRates.cs 772 B

1234567891011121314151617181920212223
  1. using Application.Abstractions.Messaging;
  2. using Web.Api.Common;
  3. namespace Web.Api.Endpoints.Market;
  4. /// <summary>환율 목록 — 지정일(미지정 시 최신 거래일)의 전 통화 환율 (수출입은행 AP01 수집, 익명 열람).</summary>
  5. internal sealed class ExchangeRates : IEndpoint
  6. {
  7. public void MapEndpoint(IEndpointRouteBuilder app)
  8. {
  9. app.MapGet("api/market/exchange-rates", async (
  10. ISender sender,
  11. DateOnly? date = null,
  12. CancellationToken ct = default
  13. ) => {
  14. var result = await sender.Send(new Application.Features.Api.Stocks.GetExchangeRates.Query(date), ct);
  15. return ApiResponse.Ok(result);
  16. })
  17. .WithTags("Market")
  18. .AllowAnonymous();
  19. }
  20. }