GamesDetail.cs 847 B

123456789101112131415161718192021222324252627
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using Application.Abstractions.Messaging;
  4. namespace Web.Api.Endpoints.Store;
  5. /// <summary>게임 상세 (Steam 스타일 페이지용) — 장르/카테고리/예고편/사양/이미지/무작위 상품 8개.</summary>
  6. internal sealed class GamesDetail : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/store/games/{id:int}", async (
  11. int id,
  12. ISender sender,
  13. CancellationToken ct
  14. ) => {
  15. var result = await sender.Send(new Application.Features.Api.Store.Games.Detail.Query(id), ct);
  16. return result.Match(
  17. () => ApiResponse.Ok(result.Value),
  18. CustomResults.Problem
  19. );
  20. })
  21. .WithTags("Store")
  22. .AllowAnonymous();
  23. }
  24. }