GamesBrowse.cs 844 B

12345678910111213141516171819202122232425262728
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using Application.Abstractions.Messaging;
  4. namespace Web.Api.Endpoints.Store;
  5. /// <summary>게임 페이지 — 활성 게임 목록 (검색·정렬).</summary>
  6. internal sealed class GamesBrowse : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/store/games/list", async (
  11. ISender sender,
  12. CancellationToken ct,
  13. string? keyword = null,
  14. string? sort = null
  15. ) => {
  16. var result = await sender.Send(new Application.Features.Api.Store.Games.Browse.Query(keyword, sort), ct);
  17. return result.Match(
  18. () => ApiResponse.Ok(result.Value),
  19. CustomResults.Problem
  20. );
  21. })
  22. .WithTags("Store")
  23. .AllowAnonymous();
  24. }
  25. }