Dropdown.cs 953 B

123456789101112131415161718192021222324252627282930
  1. using Web.Api.Common;
  2. using Web.Api.Extensions;
  3. using MediatR;
  4. using System.Security.Claims;
  5. namespace Web.Api.Endpoints.MyPage;
  6. /// <summary>프로필 드롭다운 메뉴 데이터</summary>
  7. internal sealed class Dropdown : IEndpoint
  8. {
  9. public void MapEndpoint(IEndpointRouteBuilder app)
  10. {
  11. /// 프로필 썸네일/닉네임 + 후원 가능 잔액 + 출금 가능 금액 (채널 소유자만)
  12. app.MapGet("api/mypage/dropdown", async (
  13. ClaimsPrincipal user,
  14. ISender sender,
  15. CancellationToken ct
  16. ) => {
  17. var memberID = user.GetRequiredMemberID();
  18. var result = await sender.Send(new Application.Features.Api.MyPage.Dropdown.Query(memberID), ct);
  19. return result.Match(
  20. () => ApiResponse.Ok(result.Value),
  21. CustomResults.Problem
  22. );
  23. })
  24. .WithTags("MyPage")
  25. .RequireAuthorization();
  26. }
  27. }