List.cs 917 B

1234567891011121314151617181920212223242526272829
  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. string? sort = null,
  17. string? order = null,
  18. CancellationToken ct = default
  19. ) => {
  20. var result = await sender.Send(new Application.Features.Api.Stocks.GetList.Query(q, market, page, perPage, sort, order), ct);
  21. return ApiResponse.Ok(result);
  22. })
  23. .WithTags("Stocks")
  24. .AllowAnonymous();
  25. }
  26. }