List.cs 837 B

123456789101112131415161718192021222324252627
  1. using Application.Abstractions.Messaging;
  2. using Domain.Entities.Stocks.ValueObject;
  3. using Web.Api.Common;
  4. namespace Web.Api.Endpoints.Stocks;
  5. /// <summary>종목 목록 — 시장/검색어 필터 + 페이징 (익명 열람)</summary>
  6. internal sealed class List : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/stocks", async (
  11. ISender sender,
  12. string? q = null,
  13. StockMarket? market = null,
  14. int page = 1,
  15. ushort perPage = 20,
  16. CancellationToken ct = default
  17. ) => {
  18. var result = await sender.Send(new Application.Features.Api.Stocks.GetList.Query(q, market, page, perPage), ct);
  19. return ApiResponse.Ok(result);
  20. })
  21. .WithTags("Stocks")
  22. .AllowAnonymous();
  23. }
  24. }